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