2020-07-27 06:34:20 +02:00
|
|
|
<script lang="ts">
|
2020-11-17 06:59:15 +01:00
|
|
|
import { defineComponent, h, resolveDirective, withDirectives } from 'vue';
|
2020-07-27 06:34:20 +02:00
|
|
|
|
2020-10-17 13:12:00 +02:00
|
|
|
export default defineComponent({
|
2020-07-27 06:34:20 +02:00
|
|
|
props: {
|
|
|
|
value: {
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
2020-11-17 06:59:15 +01:00
|
|
|
render() {
|
|
|
|
const options = this.$slots.default();
|
|
|
|
|
|
|
|
return withDirectives(h('div', {
|
|
|
|
class: 'pxhvhrfw',
|
|
|
|
}, options.map(option => h('button', {
|
|
|
|
class: ['_button', { active: this.value === option.props.value }],
|
|
|
|
key: option.props.value,
|
|
|
|
disabled: this.value === option.props.value,
|
|
|
|
onClick: () => {
|
|
|
|
this.$emit('update:value', option.props.value);
|
|
|
|
}
|
|
|
|
}, option.children))), [
|
|
|
|
[resolveDirective('size'), { max: [500] }]
|
|
|
|
]);
|
|
|
|
}
|
2020-07-27 06:34:20 +02:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2020-11-17 06:59:15 +01:00
|
|
|
<style lang="scss">
|
2020-07-27 06:34:20 +02:00
|
|
|
.pxhvhrfw {
|
|
|
|
display: flex;
|
2021-04-22 15:29:33 +02:00
|
|
|
font-size: 90%;
|
2020-07-27 06:34:20 +02:00
|
|
|
|
|
|
|
> button {
|
|
|
|
flex: 1;
|
2020-10-17 13:12:00 +02:00
|
|
|
padding: 15px 12px 12px 12px;
|
2020-07-27 06:34:20 +02:00
|
|
|
border-bottom: solid 3px transparent;
|
|
|
|
|
2020-11-01 06:05:06 +01:00
|
|
|
&:disabled {
|
|
|
|
opacity: 1 !important;
|
|
|
|
cursor: default;
|
|
|
|
}
|
|
|
|
|
2020-07-27 06:34:20 +02:00
|
|
|
&.active {
|
|
|
|
color: var(--accent);
|
|
|
|
border-bottom-color: var(--accent);
|
|
|
|
}
|
2020-07-28 03:08:08 +02:00
|
|
|
|
2020-11-01 06:05:06 +01:00
|
|
|
&:not(.active):hover {
|
|
|
|
color: var(--fgHighlighted);
|
|
|
|
}
|
|
|
|
|
2020-07-28 03:08:08 +02:00
|
|
|
> .icon {
|
|
|
|
margin-right: 6px;
|
|
|
|
}
|
2020-07-27 06:34:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
&.max-width_500px {
|
|
|
|
font-size: 80%;
|
2020-10-17 13:12:00 +02:00
|
|
|
|
|
|
|
> button {
|
|
|
|
padding: 11px 8px 8px 8px;
|
|
|
|
}
|
2020-07-27 06:34:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|