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