summaryrefslogtreecommitdiff
path: root/packages/frontend/src/components/MkTab.vue
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2022-12-27 14:36:33 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2022-12-27 14:36:33 +0900
commit9384f5399da39e53855beb8e7f8ded1aa56bf72e (patch)
treece5959571a981b9c4047da3c7b3fd080aa44222c /packages/frontend/src/components/MkTab.vue
parentwip: retention for dashboard (diff)
downloadmisskey-9384f5399da39e53855beb8e7f8ded1aa56bf72e.tar.gz
misskey-9384f5399da39e53855beb8e7f8ded1aa56bf72e.tar.bz2
misskey-9384f5399da39e53855beb8e7f8ded1aa56bf72e.zip
rename: client -> frontend
Diffstat (limited to 'packages/frontend/src/components/MkTab.vue')
-rw-r--r--packages/frontend/src/components/MkTab.vue73
1 files changed, 73 insertions, 0 deletions
diff --git a/packages/frontend/src/components/MkTab.vue b/packages/frontend/src/components/MkTab.vue
new file mode 100644
index 0000000000..669e9e2e11
--- /dev/null
+++ b/packages/frontend/src/components/MkTab.vue
@@ -0,0 +1,73 @@
+<script lang="ts">
+import { defineComponent, h, resolveDirective, withDirectives } from 'vue';
+
+export default defineComponent({
+ props: {
+ modelValue: {
+ required: true,
+ },
+ },
+ render() {
+ const options = this.$slots.default();
+
+ return withDirectives(h('div', {
+ class: 'pxhvhrfw',
+ }, 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')],
+ ]))), [
+ [resolveDirective('size'), { max: [500] }],
+ ]);
+ },
+});
+</script>
+
+<style lang="scss">
+.pxhvhrfw {
+ display: flex;
+ font-size: 90%;
+
+ > button {
+ flex: 1;
+ padding: 10px 8px;
+ border-radius: var(--radius);
+
+ &:disabled {
+ opacity: 1 !important;
+ cursor: default;
+ }
+
+ &.active {
+ color: var(--accent);
+ background: var(--accentedBg);
+ }
+
+ &:not(.active):hover {
+ color: var(--fgHighlighted);
+ background: var(--panelHighlight);
+ }
+
+ &:not(:first-child) {
+ margin-left: 8px;
+ }
+
+ > .icon {
+ margin-right: 6px;
+ }
+ }
+
+ &.max-width_500px {
+ font-size: 80%;
+
+ > button {
+ padding: 11px 8px;
+ }
+ }
+}
+</style>