mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-14 09:33:09 +02:00
0144408500
* wip * Update maps.ts * wip * wip * wip * wip * Update base.vue * wip * wip * wip * wip * Update link.vue * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update privacy.vue * wip * wip * wip * wip * Update range.vue * wip * wip * wip * wip * Update profile.vue * wip * Update a.vue * Update index.vue * wip * Update sidebar.vue * wip * wip * Update account-info.vue * Update a.vue * wip * wip * Update sounds.vue * wip * wip * wip * wip * wip * wip * wip * wip * Update account-info.vue * Update account-info.vue * wip * wip * wip * Update d-persimmon.json5 * wip
132 lines
2.2 KiB
Vue
132 lines
2.2 KiB
Vue
<template>
|
|
<div class="ijnpvmgr _formItem">
|
|
<div class="main _formPanel _formClickable"
|
|
:class="{ disabled, checked }"
|
|
:aria-checked="checked"
|
|
:aria-disabled="disabled"
|
|
@click.prevent="toggle"
|
|
>
|
|
<input
|
|
type="checkbox"
|
|
ref="input"
|
|
:disabled="disabled"
|
|
@keydown.enter="toggle"
|
|
>
|
|
<span class="button">
|
|
<span></span>
|
|
</span>
|
|
<span class="label">
|
|
<span><slot></slot></span>
|
|
</span>
|
|
</div>
|
|
<div class="_formCaption"><slot name="desc"></slot></div>
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import { defineComponent } from 'vue';
|
|
import './form.scss';
|
|
|
|
export default defineComponent({
|
|
props: {
|
|
value: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
disabled: {
|
|
type: Boolean,
|
|
default: false
|
|
}
|
|
},
|
|
computed: {
|
|
checked(): boolean {
|
|
return this.value;
|
|
}
|
|
},
|
|
methods: {
|
|
toggle() {
|
|
if (this.disabled) return;
|
|
this.$emit('update:value', !this.checked);
|
|
}
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.ijnpvmgr {
|
|
> .main {
|
|
position: relative;
|
|
display: flex;
|
|
padding: 16px;
|
|
cursor: pointer;
|
|
|
|
> * {
|
|
user-select: none;
|
|
}
|
|
|
|
&.disabled {
|
|
opacity: 0.6;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
&.checked {
|
|
> .button {
|
|
background-color: var(--X10);
|
|
border-color: var(--X10);
|
|
|
|
> * {
|
|
background-color: var(--accent);
|
|
transform: translateX(14px);
|
|
}
|
|
}
|
|
}
|
|
|
|
> input {
|
|
position: absolute;
|
|
width: 0;
|
|
height: 0;
|
|
opacity: 0;
|
|
margin: 0;
|
|
}
|
|
|
|
> .button {
|
|
position: relative;
|
|
display: inline-block;
|
|
flex-shrink: 0;
|
|
margin: 3px 0 0 0;
|
|
width: 34px;
|
|
height: 14px;
|
|
background: var(--X6);
|
|
outline: none;
|
|
border-radius: 14px;
|
|
transition: all 0.3s;
|
|
cursor: pointer;
|
|
|
|
> * {
|
|
position: absolute;
|
|
top: -3px;
|
|
left: 0;
|
|
border-radius: 100%;
|
|
transition: background-color 0.3s, transform 0.3s;
|
|
width: 20px;
|
|
height: 20px;
|
|
background-color: #fff;
|
|
box-shadow: 0 2px 1px -1px rgba(#000, 0.2), 0 1px 1px 0 rgba(#000, 0.14), 0 1px 3px 0 rgba(#000, 0.12);
|
|
}
|
|
}
|
|
|
|
> .label {
|
|
margin-left: 12px;
|
|
display: block;
|
|
transition: inherit;
|
|
color: var(--fg);
|
|
|
|
> span {
|
|
display: block;
|
|
line-height: 20px;
|
|
transition: inherit;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|