Skip to content

Commit 00bfa51

Browse files
committed
Add disabled state to back button
1 parent def4c4c commit 00bfa51

File tree

2 files changed

+30
-10
lines changed

2 files changed

+30
-10
lines changed

src/components/AppSidebar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function handleBack() {
2424
<nav class="nav">
2525
<div class="upper">
2626
<SidebarButton
27-
v-if="store.currentPage === Page.Settings"
27+
:disabled="store.currentPage !== Page.Settings"
2828
@click="handleBack"
2929
>
3030
<Icons.ChevronLeft />

src/components/SidebarButton.vue

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
1+
<script lang="ts" setup>
2+
interface Props {
3+
disabled?: boolean
4+
}
5+
6+
const props = withDefaults(defineProps<Props>(), {
7+
disabled: false,
8+
})
9+
</script>
10+
111
<template>
2-
<button class="sidebar-button">
12+
<button
13+
class="sidebar-button"
14+
:disabled="disabled || undefined"
15+
:class="{ disabled }"
16+
>
317
<slot />
418
</button>
519
</template>
@@ -12,17 +26,23 @@
1226
border: 1px solid transparent;
1327
@include focus-visible;
1428
15-
&:active {
16-
background-color: var(--item-hover-bg);
29+
&.disabled {
30+
opacity: .3;
31+
}
32+
33+
&:not(.disabled) {
34+
&:active {
35+
background-color: var(--item-hover-bg);
1736
18-
:deep(.icon) {
19-
color: var(--white);
37+
:deep(.icon) {
38+
color: var(--white);
39+
}
2040
}
21-
}
2241
23-
&:hover {
24-
:deep(.icon) {
25-
color: var(--white);
42+
&:hover {
43+
:deep(.icon) {
44+
color: var(--white);
45+
}
2646
}
2747
}
2848

0 commit comments

Comments
 (0)