2023-07-27 07:31:52 +02:00
|
|
|
<!--
|
2024-02-13 16:59:27 +01:00
|
|
|
SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-07-27 07:31:52 +02:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
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: {
|
2021-09-29 17:50:45 +02:00
|
|
|
modelValue: {
|
2020-07-27 06:34:20 +02:00
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
2023-05-14 05:23:39 +02:00
|
|
|
setup(props, { emit, slots }) {
|
2024-01-30 11:53:53 +01:00
|
|
|
const options = slots.default?.() ?? [];
|
2020-11-17 06:59:15 +01:00
|
|
|
|
2023-05-14 05:23:39 +02:00
|
|
|
return () => h('div', {
|
2020-11-17 06:59:15 +01:00
|
|
|
class: 'pxhvhrfw',
|
2021-04-24 15:36:28 +02:00
|
|
|
}, options.map(option => withDirectives(h('button', {
|
2024-01-30 11:53:53 +01:00
|
|
|
class: ['_button', { active: props.modelValue === option.props?.value }],
|
|
|
|
key: option.key as string,
|
|
|
|
disabled: props.modelValue === option.props?.value,
|
2020-11-17 06:59:15 +01:00
|
|
|
onClick: () => {
|
2024-01-30 11:53:53 +01:00
|
|
|
emit('update:modelValue', option.props?.value);
|
2022-07-24 08:45:16 +02:00
|
|
|
},
|
2024-01-30 11:53:53 +01:00
|
|
|
}, option.children ?? []), [
|
2022-07-24 08:45:16 +02:00
|
|
|
[resolveDirective('click-anime')],
|
2022-12-28 01:32:22 +01:00
|
|
|
])));
|
2022-07-24 08:45:16 +02:00
|
|
|
},
|
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;
|
2021-10-16 11:18:41 +02:00
|
|
|
padding: 10px 8px;
|
2023-10-31 19:44:34 +01:00
|
|
|
border-radius: var(--radius-ellipse);
|
2020-07-27 06:34:20 +02:00
|
|
|
|
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);
|
2021-10-16 11:18:41 +02:00
|
|
|
background: var(--accentedBg);
|
2020-07-27 06:34:20 +02:00
|
|
|
}
|
2020-07-28 03:08:08 +02:00
|
|
|
|
2020-11-01 06:05:06 +01:00
|
|
|
&:not(.active):hover {
|
|
|
|
color: var(--fgHighlighted);
|
2021-10-16 11:18:41 +02:00
|
|
|
background: var(--panelHighlight);
|
|
|
|
}
|
|
|
|
|
|
|
|
&:not(:first-child) {
|
|
|
|
margin-left: 8px;
|
2020-11-01 06:05:06 +01:00
|
|
|
}
|
|
|
|
|
2020-07-28 03:08:08 +02:00
|
|
|
> .icon {
|
|
|
|
margin-right: 6px;
|
|
|
|
}
|
2020-07-27 06:34:20 +02:00
|
|
|
}
|
2022-12-28 01:32:22 +01:00
|
|
|
}
|
2020-07-27 06:34:20 +02:00
|
|
|
|
2022-12-28 01:32:22 +01:00
|
|
|
@container (max-width: 500px) {
|
|
|
|
.pxhvhrfw {
|
2020-07-27 06:34:20 +02:00
|
|
|
font-size: 80%;
|
2020-10-17 13:12:00 +02:00
|
|
|
|
|
|
|
> button {
|
2021-10-16 11:18:41 +02:00
|
|
|
padding: 11px 8px;
|
2020-10-17 13:12:00 +02:00
|
|
|
}
|
2020-07-27 06:34:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|