enhance(frontend): ユーザーメニューでスイッチでユーザーリストに追加・削除できるように (#11439)
* メニューのトグルをいい感じにする * user list toggle! * add changelog * fix * stop
This commit is contained in:
parent
2b4c8c9e0f
commit
8a72a05958
11 changed files with 214 additions and 85 deletions
|
@ -12,9 +12,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
:class="$style.input"
|
||||
@keydown.enter="toggle"
|
||||
>
|
||||
<span ref="button" v-tooltip="checked ? i18n.ts.itsOn : i18n.ts.itsOff" :class="$style.button" data-cy-switch-toggle @click.prevent="toggle">
|
||||
<div :class="$style.knob"></div>
|
||||
</span>
|
||||
<XButton :checked="checked" :disabled="disabled" @toggle="toggle" />
|
||||
<span :class="$style.body">
|
||||
<!-- TODO: 無名slotの方は廃止 -->
|
||||
<span :class="$style.label" @click="toggle"><slot name="label"></slot><slot></slot></span>
|
||||
|
@ -25,7 +23,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { toRefs, Ref } from 'vue';
|
||||
import { i18n } from '@/i18n';
|
||||
import XButton from '@/components/MkSwitch.button.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: boolean | Ref<boolean>;
|
||||
|
@ -36,7 +34,6 @@ const emit = defineEmits<{
|
|||
(ev: 'update:modelValue', v: boolean): void;
|
||||
}>();
|
||||
|
||||
let button = $shallowRef<HTMLElement>();
|
||||
const checked = toRefs(props).modelValue;
|
||||
const toggle = () => {
|
||||
if (props.disabled) return;
|
||||
|
@ -66,17 +63,8 @@ const toggle = () => {
|
|||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
&.checked {
|
||||
> .button {
|
||||
background-color: var(--switchOnBg) !important;
|
||||
border-color: var(--switchOnBg) !important;
|
||||
|
||||
> .knob {
|
||||
left: 12px;
|
||||
background: var(--switchOnFg);
|
||||
}
|
||||
}
|
||||
}
|
||||
//&.checked {
|
||||
//}
|
||||
}
|
||||
|
||||
.input {
|
||||
|
@ -86,36 +74,6 @@ const toggle = () => {
|
|||
opacity: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.button {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
flex-shrink: 0;
|
||||
margin: 0;
|
||||
box-sizing: border-box;
|
||||
width: 32px;
|
||||
height: 23px;
|
||||
outline: none;
|
||||
background: var(--switchOffBg);
|
||||
background-clip: content-box;
|
||||
border: solid 1px var(--switchOffBg);
|
||||
border-radius: 999px;
|
||||
cursor: pointer;
|
||||
transition: inherit;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.knob {
|
||||
position: absolute;
|
||||
top: 3px;
|
||||
left: 3px;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
background: var(--switchOffFg);
|
||||
border-radius: 999px;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.body {
|
||||
margin-left: 12px;
|
||||
margin-top: 2px;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue