2020-07-26 23:34:20 -05:00
|
|
|
<script lang="ts">
|
2020-11-16 23:59:15 -06:00
|
|
|
import { defineComponent, h, resolveDirective, withDirectives } from 'vue';
|
2020-07-26 23:34:20 -05:00
|
|
|
|
2020-10-17 06:12:00 -05:00
|
|
|
export default defineComponent({
|
2020-07-26 23:34:20 -05:00
|
|
|
props: {
|
2021-09-29 10:50:45 -05:00
|
|
|
modelValue: {
|
2020-07-26 23:34:20 -05:00
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
2020-11-16 23:59:15 -06:00
|
|
|
render() {
|
|
|
|
const options = this.$slots.default();
|
|
|
|
|
2022-12-27 18:32:22 -06:00
|
|
|
return h('div', {
|
2020-11-16 23:59:15 -06:00
|
|
|
class: 'pxhvhrfw',
|
2021-04-24 08:36:28 -05:00
|
|
|
}, options.map(option => withDirectives(h('button', {
|
2021-10-01 05:34:24 -05:00
|
|
|
class: ['_button', { active: this.modelValue === option.props.value }],
|
2021-07-19 09:30:12 -05:00
|
|
|
key: option.key,
|
2021-10-01 05:34:24 -05:00
|
|
|
disabled: this.modelValue === option.props.value,
|
2020-11-16 23:59:15 -06:00
|
|
|
onClick: () => {
|
2021-10-01 05:34:24 -05:00
|
|
|
this.$emit('update:modelValue', option.props.value);
|
2022-07-24 01:45:16 -05:00
|
|
|
},
|
2021-04-24 08:36:28 -05:00
|
|
|
}, option.children), [
|
2022-07-24 01:45:16 -05:00
|
|
|
[resolveDirective('click-anime')],
|
2022-12-27 18:32:22 -06:00
|
|
|
])));
|
2022-07-24 01:45:16 -05:00
|
|
|
},
|
2020-07-26 23:34:20 -05:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2020-11-16 23:59:15 -06:00
|
|
|
<style lang="scss">
|
2020-07-26 23:34:20 -05:00
|
|
|
.pxhvhrfw {
|
|
|
|
display: flex;
|
2021-04-22 08:29:33 -05:00
|
|
|
font-size: 90%;
|
2020-07-26 23:34:20 -05:00
|
|
|
|
|
|
|
> button {
|
|
|
|
flex: 1;
|
2021-10-16 04:18:41 -05:00
|
|
|
padding: 10px 8px;
|
2021-10-17 04:47:33 -05:00
|
|
|
border-radius: var(--radius);
|
2020-07-26 23:34:20 -05:00
|
|
|
|
2020-11-01 00:05:06 -05:00
|
|
|
&:disabled {
|
|
|
|
opacity: 1 !important;
|
|
|
|
cursor: default;
|
|
|
|
}
|
|
|
|
|
2020-07-26 23:34:20 -05:00
|
|
|
&.active {
|
|
|
|
color: var(--accent);
|
2021-10-16 04:18:41 -05:00
|
|
|
background: var(--accentedBg);
|
2020-07-26 23:34:20 -05:00
|
|
|
}
|
2020-07-27 20:08:08 -05:00
|
|
|
|
2020-11-01 00:05:06 -05:00
|
|
|
&:not(.active):hover {
|
|
|
|
color: var(--fgHighlighted);
|
2021-10-16 04:18:41 -05:00
|
|
|
background: var(--panelHighlight);
|
|
|
|
}
|
|
|
|
|
|
|
|
&:not(:first-child) {
|
|
|
|
margin-left: 8px;
|
2020-11-01 00:05:06 -05:00
|
|
|
}
|
|
|
|
|
2020-07-27 20:08:08 -05:00
|
|
|
> .icon {
|
|
|
|
margin-right: 6px;
|
|
|
|
}
|
2020-07-26 23:34:20 -05:00
|
|
|
}
|
2022-12-27 18:32:22 -06:00
|
|
|
}
|
2020-07-26 23:34:20 -05:00
|
|
|
|
2022-12-27 18:32:22 -06:00
|
|
|
@container (max-width: 500px) {
|
|
|
|
.pxhvhrfw {
|
2020-07-26 23:34:20 -05:00
|
|
|
font-size: 80%;
|
2020-10-17 06:12:00 -05:00
|
|
|
|
|
|
|
> button {
|
2021-10-16 04:18:41 -05:00
|
|
|
padding: 11px 8px;
|
2020-10-17 06:12:00 -05:00
|
|
|
}
|
2020-07-26 23:34:20 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|