summaryrefslogtreecommitdiff
path: root/src/client/components/form/radios.vue
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/components/form/radios.vue')
-rw-r--r--src/client/components/form/radios.vue88
1 files changed, 21 insertions, 67 deletions
diff --git a/src/client/components/form/radios.vue b/src/client/components/form/radios.vue
index b660c37ace..1d3d80172a 100644
--- a/src/client/components/form/radios.vue
+++ b/src/client/components/form/radios.vue
@@ -1,7 +1,6 @@
<script lang="ts">
import { defineComponent, h } from 'vue';
-import MkRadio from '@client/components/ui/radio.vue';
-import './form.scss';
+import MkRadio from './radio.vue';
export default defineComponent({
components: {
@@ -18,9 +17,6 @@ export default defineComponent({
}
},
watch: {
- modelValue() {
- this.value = this.modelValue;
- },
value() {
this.$emit('update:modelValue', this.value);
}
@@ -33,80 +29,38 @@ export default defineComponent({
if (options.length === 1 && options[0].props == null) options = options[0].children;
return h('div', {
- class: 'cnklmpwm _formItem'
+ class: 'novjtcto'
}, [
- h('div', {
- class: '_formLabel',
- }, label),
- ...options.map(option => h('button', {
- class: '_button _formPanel _formClickable',
+ h('div', { class: 'label' }, label),
+ ...options.map(option => h(MkRadio, {
key: option.key,
- onClick: () => this.value = option.props.value,
- }, [h('span', {
- class: ['check', { checked: this.value === option.props.value }],
- }), option.children]))
+ value: option.props.value,
+ modelValue: this.value,
+ 'onUpdate:modelValue': value => this.value = value,
+ }, option.children))
]);
}
});
</script>
<style lang="scss">
-.cnklmpwm {
- > button {
- display: block;
- width: 100%;
- box-sizing: border-box;
- padding: 14px 18px;
- text-align: left;
-
- &:not(:first-of-type) {
- border-top: none !important;
- border-top-left-radius: 0;
- border-top-right-radius: 0;
- }
+.novjtcto {
+ > .label {
+ font-size: 0.85em;
+ padding: 0 0 8px 12px;
+ user-select: none;
- &:not(:last-of-type) {
- border-bottom: solid 0.5px var(--divider);
- border-bottom-left-radius: 0;
- border-bottom-right-radius: 0;
+ &:empty {
+ display: none;
}
+ }
- > .check {
- display: inline-block;
- vertical-align: bottom;
- position: relative;
- width: 16px;
- height: 16px;
- margin-right: 8px;
- background: none;
- border: 2px solid var(--inputBorder);
- border-radius: 100%;
- transition: inherit;
-
- &:after {
- content: "";
- display: block;
- position: absolute;
- top: 3px;
- right: 3px;
- bottom: 3px;
- left: 3px;
- border-radius: 100%;
- opacity: 0;
- transform: scale(0);
- transition: .4s cubic-bezier(.25,.8,.25,1);
- }
-
- &.checked {
- border-color: var(--accent);
+ &:first-child {
+ margin-top: 0;
+ }
- &:after {
- background-color: var(--accent);
- transform: scale(1);
- opacity: 1;
- }
- }
- }
+ &:last-child {
+ margin-bottom: 0;
}
}
</style>