main
vue 144 lines 3.58 KB
Raw
1 <template>
2 <header class="toolbar" :class="{ boxed }">
3 <div class="wrap flex items-center justify-end gap-3">
4 <div class="logo-box flex cursor-pointer items-center gap-2" @click="openNav()">
5 <Logo />
6 <Icon :size="20" name="carbon:chevron-right" />
7 </div>
8
9 <Breadcrumb class="grow" />
10
11 <PillWrapper class="pl-3!">
12 <FullscreenSwitch />
13 <ThemeSwitch />
14 <Avatar />
15 </PillWrapper>
16 </div>
17
18 <BlurEffect />
19 <div v-if="gradient" :class="`gradient-${gradient}`"></div>
20 </header>
21 </template>
22
23 <script lang="ts" setup>
24 import BlurEffect from "@/components/common/BlurEffect.vue"
25 import Icon from "@/components/common/Icon.vue"
26 import { useThemeStore } from "@/stores/theme"
27 import Logo from "../Logo.vue"
28 import Avatar from "./Avatar.vue"
29 import Breadcrumb from "./Breadcrumb.vue"
30 import FullscreenSwitch from "./FullscreenSwitch.vue"
31 import PillWrapper from "./PillWrapper.vue"
32 import ThemeSwitch from "./ThemeSwitch.vue"
33
34 const { boxed, gradient } = defineProps<{
35 boxed: boolean
36 gradient?: "body" | "sidebar"
37 }>()
38
39 const themeStore = useThemeStore()
40 const openNav = () => themeStore.openSidebar()
41 </script>
42
43 <style lang="scss" scoped>
44 .toolbar {
45 position: sticky;
46 top: 0;
47 left: 0;
48 height: var(--toolbar-height);
49 width: 100%;
50 max-width: 100%;
51 padding: 0 var(--view-padding);
52 z-index: 3;
53 overflow: hidden;
54
55 .wrap {
56 height: var(--toolbar-height);
57 overflow: hidden;
58 width: 100%;
59 max-width: 100%;
60 position: relative;
61 z-index: 1;
62
63 @media (max-width: 850px) {
64 .pinned-pages {
65 display: none;
66 }
67 }
68
69 @media (max-width: 700px) {
70 justify-content: space-between;
71 .breadcrumb {
72 display: none;
73 }
74 }
75 }
76
77 &.boxed {
78 padding: 0;
79 .wrap {
80 padding: 0 var(--view-padding);
81 max-width: var(--boxed-width);
82 margin: 0 auto;
83 }
84 }
85
86 .gradient-sidebar {
87 position: absolute;
88 inset: 0;
89 background-color: var(--bg-sidebar-color);
90 background: linear-gradient(
91 to bottom,
92 rgba(var(--bg-sidebar-color-rgb) / 1) 0%,
93 rgba(var(--bg-sidebar-color-rgb) / 0.945) 8.6%,
94 rgba(var(--bg-sidebar-color-rgb) / 0.888) 16.2%,
95 rgba(var(--bg-sidebar-color-rgb) / 0.83) 22.9%,
96 rgba(var(--bg-sidebar-color-rgb) / 0.769) 28.9%,
97 rgba(var(--bg-sidebar-color-rgb) / 0.707) 34.4%,
98 rgba(var(--bg-sidebar-color-rgb) / 0.644) 39.5%,
99 rgba(var(--bg-sidebar-color-rgb) / 0.578) 44.5%,
100 rgba(var(--bg-sidebar-color-rgb) / 0.511) 49.5%,
101 rgba(var(--bg-sidebar-color-rgb) / 0.443) 54.7%,
102 rgba(var(--bg-sidebar-color-rgb) / 0.373) 60.3%,
103 rgba(var(--bg-sidebar-color-rgb) / 0.301) 66.4%,
104 rgba(var(--bg-sidebar-color-rgb) / 0.228) 73.3%,
105 rgba(var(--bg-sidebar-color-rgb) / 0.153) 81%,
106 rgba(var(--bg-sidebar-color-rgb) / 0.077) 89.9%,
107 rgba(var(--bg-sidebar-color-rgb) / 0) 100%
108 );
109 }
110 .gradient-body {
111 position: absolute;
112 inset: 0;
113 background-color: var(--bg-body-color);
114 background: linear-gradient(
115 to bottom,
116 rgba(var(--bg-body-color-rgb) / 1) 0%,
117 rgba(var(--bg-body-color-rgb) / 0.738) 19%,
118 rgba(var(--bg-body-color-rgb) / 0.541) 34%,
119 rgba(var(--bg-body-color-rgb) / 0.382) 47%,
120 rgba(var(--bg-body-color-rgb) / 0.278) 56.5%,
121 rgba(var(--bg-body-color-rgb) / 0.194) 65%,
122 rgba(var(--bg-body-color-rgb) / 0.126) 73%,
123 rgba(var(--bg-body-color-rgb) / 0.075) 80.2%,
124 rgba(var(--bg-body-color-rgb) / 0.042) 86.1%,
125 rgba(var(--bg-body-color-rgb) / 0.021) 91%,
126 rgba(var(--bg-body-color-rgb) / 0.008) 95.2%,
127 rgba(var(--bg-body-color-rgb) / 0.002) 98.2%,
128 rgba(var(--bg-body-color-rgb) / 0) 100%
129 );
130 }
131 }
132
133 .direction-rtl {
134 .toolbar {
135 .wrap {
136 .logo-box {
137 .n-icon {
138 transform: rotateY(180deg);
139 }
140 }
141 }
142 }
143 }
144 </style>