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