-
Notifications
You must be signed in to change notification settings - Fork 96
Expand file tree
/
Copy pathNcAppSidebarTabsButton.vue
More file actions
113 lines (97 loc) Ā· 2.55 KB
/
NcAppSidebarTabsButton.vue
File metadata and controls
113 lines (97 loc) Ā· 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!--
- SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<script setup lang="ts">
import type NcAppSidebarTab from '../NcAppSidebarTab/NcAppSidebarTab.vue'
import NcVNodes from '../NcVNodes/NcVNodes.vue'
const selected = defineModel<boolean>('selected', { required: true })
defineProps<{
/**
* The sidebar tab this button controls
*/
tab: InstanceType<typeof NcAppSidebarTab>
}>()
</script>
<template>
<button
class="button-vue"
:class="[$style.sidebarTabsButton, {
[$style.sidebarTabsButton_selected]: selected,
}]"
role="tab"
:aria-selected="selected"
:tabindex="selected ? 0 : -1"
@click="selected = true">
<span :class="$style.sidebarTabsButton__icon">
<NcVNodes :vnodes="tab.renderIcon()">
<span :class="[$style.sidebarTabsButton__legacyIcon, tab.icon]" />
</NcVNodes>
</span>
<span :class="$style.sidebarTabsButton__name">
{{ tab.name }}
</span>
</button>
</template>
<style module lang="scss">
.sidebarTabsButton {
border: none;
border-bottom: var(--default-grid-baseline) solid transparent !important;
border-radius: var(--border-radius-small);
background-color: var(--color-main-background);
color: var(--color-main-text);
font-size: var(--default-font-size);
cursor: pointer;
display: flex;
flex-direction: column;
gap: var(--default-grid-baseline);
padding: var(--border-radius-small);
transition:
background-color var(--animation-quick),
border-bottom-color var(--animation-quick);
min-width: var(--default-clickable-area);
&:hover {
background-color: var(--color-background-hover) !important;
}
&:active,
&:focus {
background-color: var(--color-main-background) !important;
}
* {
cursor: pointer;
}
}
.sidebarTabsButton_selected {
border-bottom-color: var(--color-primary-element) !important;
border-bottom-left-radius: 0px;
border-bottom-right-radius: 0px;
cursor: default;
&:hover {
background-color: var(--color-primary-element-light-hover) !important;
color: var(--color-primary-element-light-text) !important;
}
* {
cursor: default;
}
}
.sidebarTabsButton__name {
font-weight: var(--font-weight-element, normal);
overflow: hidden;
text-overflow: ellipsis;
text-wrap: nowrap;
}
.sidebarTabsButton_selected .sidebarTabsButton__name {
font-weight: var(--font-weight-element, bold);
}
.sidebarTabsButton__icon {
display: inline-flex;
align-items: center;
justify-content: center;
}
.sidebarTabsButton__legacyIcon {
background-size: 20px;
display: flex;
align-items: center;
justify-content: center;
}
</style>