Skip to content

Commit 096e916

Browse files
committed
:refactor: do some ui refactoring
1 parent 012b44c commit 096e916

File tree

5 files changed

+39
-86
lines changed

5 files changed

+39
-86
lines changed

src/components.d.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ declare module 'vue' {
1010
ArabicIcon: typeof import('./components/CountryIcons/ArabicIcon.vue')['default']
1111
BarChart: typeof import('./components/BarChart.vue')['default']
1212
BrandManagement: typeof import('./components/Brand/BrandManagement.vue')['default']
13+
BreadCrumb: typeof import('./components/Navbar/BreadCrumb.vue')['default']
1314
Card: typeof import('./components/Card.vue')['default']
1415
CategoryManagement: typeof import('./components/Category/CategoryManagement.vue')['default']
1516
CategoryStatics: typeof import('./components/Category/CategoryStatics.vue')['default']
@@ -41,28 +42,19 @@ declare module 'vue' {
4142
NDrawer: typeof import('naive-ui')['NDrawer']
4243
NDrawerContent: typeof import('naive-ui')['NDrawerContent']
4344
NDropdown: typeof import('naive-ui')['NDropdown']
44-
NForm: typeof import('naive-ui')['NForm']
45-
NFormItem: typeof import('naive-ui')['NFormItem']
4645
NIcon: typeof import('naive-ui')['NIcon']
47-
NInput: typeof import('naive-ui')['NInput']
4846
NLayout: typeof import('naive-ui')['NLayout']
49-
NLayoutContent: typeof import('naive-ui')['NLayoutContent']
5047
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
5148
NMenu: typeof import('naive-ui')['NMenu']
5249
NMessageProvider: typeof import('naive-ui')['NMessageProvider']
53-
NModal: typeof import('naive-ui')['NModal']
5450
NNotificationProvider: typeof import('naive-ui')['NNotificationProvider']
5551
Notifications: typeof import('./components/Navbar/Notifications.vue')['default']
5652
NPageHeader: typeof import('naive-ui')['NPageHeader']
5753
NPopselect: typeof import('naive-ui')['NPopselect']
58-
NRadioButton: typeof import('naive-ui')['NRadioButton']
59-
NRadioGroup: typeof import('naive-ui')['NRadioGroup']
6054
NSpace: typeof import('naive-ui')['NSpace']
6155
NSwitch: typeof import('naive-ui')['NSwitch']
6256
NTag: typeof import('naive-ui')['NTag']
6357
NTooltip: typeof import('naive-ui')['NTooltip']
64-
NTreeSelect: typeof import('naive-ui')['NTreeSelect']
65-
NUpload: typeof import('naive-ui')['NUpload']
6658
OrderManagement: typeof import('./components/Orders/OrderManagement.vue')['default']
6759
PersianIcon: typeof import('./components/CountryIcons/PersianIcon.vue')['default']
6860
ProductsManagement: typeof import('./components/Products/ProductsManagement.vue')['default']

src/components/Navbar/BreadCrumb.vue

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<script lang="ts" setup>
2+
const route = useRoute()
3+
const { t } = useI18n()
4+
</script>
5+
6+
<template>
7+
<n-breadcrumb class="hidden md:block">
8+
<n-breadcrumb-item>
9+
<RouterLink to="/">
10+
{{ t('home') }}
11+
</RouterLink>
12+
</n-breadcrumb-item>
13+
<n-breadcrumb-item v-for="item in route.meta.breadcrumb" :key="item">
14+
{{ t(`menu.${item}`) }}
15+
</n-breadcrumb-item>
16+
</n-breadcrumb>
17+
</template>

src/components/Navbar/Navbar.vue

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,29 @@
1-
<script setup lang="ts">
2-
import { Home28Regular as HomeIcon } from '@vicons/fluent'
1+
<script lang="ts" setup>
2+
import {
3+
PanelLeftContract24Regular as CollapseIcon,
4+
PanelLeftExpand20Regular as ExpandIcon,
5+
} from '@vicons/fluent'
36
4-
const route = useRoute()
5-
const { t } = useI18n()
7+
import { storeToRefs } from 'pinia'
8+
9+
const layoutStore = useLayoutStore()
10+
const { collapsed } = storeToRefs(layoutStore)
611
</script>
712

813
<template>
914
<n-page-header class="px-2 py-3 navbar">
1015
<template #title>
11-
<n-breadcrumb>
12-
<n-breadcrumb-item>
13-
<RouterLink to="/">
14-
<n-icon :component="HomeIcon" /> {{ t('home') }}
15-
</RouterLink>
16-
</n-breadcrumb-item>
17-
<n-breadcrumb-item v-for="item in route.meta.breadcrumb" :key="item">
18-
{{ t(`menu.${item}`) }}
19-
</n-breadcrumb-item>
20-
</n-breadcrumb>
16+
<div class="flex items-center">
17+
<n-button mx-2 size="small" quaternary circle @click="layoutStore.toggleSidebar">
18+
<template #icon>
19+
<NIcon size="1.2rem">
20+
<ExpandIcon v-if="collapsed" />
21+
<CollapseIcon v-else />
22+
</NIcon>
23+
</template>
24+
</n-button>
25+
<BreadCrumb />
26+
</div>
2127
</template>
2228
<template #extra>
2329
<div class="flex items-center">

src/components/Sidebar.vue

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@ import {
55
PersonSettings20Regular as AccountSettingsIcon,
66
CheckmarkStarburst16Regular as BrandsIcon,
77
Folder32Regular as CategoryIcon,
8-
Pin20Regular as CollapsedIcon,
98
Color24Regular as ColorsIcon,
109
CommentMultiple32Regular as CommentsIcon,
1110
People28Regular as CustomersIcon,
1211
Home32Regular as DashboardIcon,
1312
Emoji24Regular as FeedbackIcon,
1413
Cart24Regular as InvoicesIcon,
1514
DocumentLink20Regular as PagesIcon,
16-
Pin20Filled as PinnedIcon,
1715
Apps28Filled as ProductsIcon,
1816
BoxMultiple20Regular as ProductsIcon2,
1917
StarThreeQuarter20Filled as ReviewIcon,
@@ -112,29 +110,6 @@ const menuOptions: MenuOption[] = [
112110
},
113111
],
114112
},
115-
116-
// {
117-
// label: () => t('menu.announcement'),
118-
// key: 'notify',
119-
// icon: renderIcon(NewsIcon),
120-
// children: [
121-
// {
122-
// label: () => renderLabel(t('menu.news'), '/news'),
123-
// key: 'news',
124-
// icon: renderIcon(NewsIcon),
125-
// },
126-
// {
127-
// label: () => renderLabel(t('menu.notifications'), '/notify'),
128-
// key: 'notifications',
129-
// icon: renderIcon(NotifyIcon),
130-
// },
131-
// {
132-
// label: () => renderLabel(t('menu.sms'), 'sms'),
133-
// key: 'sms',
134-
// icon: renderIcon(SmsIcon),
135-
// },
136-
// ],
137-
// },
138113
{
139114
label: () => t('menu.pages'),
140115
key: 'pages',
@@ -192,20 +167,11 @@ function renderIcon(icon: any, showBadge = false) {
192167
:class="{ collapsed: effectiveCollapsed }" @mouseenter="isHovered = true" @mouseleave="isHovered = false"
193168
>
194169
<div class="logo-container">
195-
<div flex w-full justify-between items-center>
170+
<div flex w-full justify-start items-center>
196171
<img src="@/assets/images/logo.png" alt="logo" class="logo">
197172
<h1 class="main-title">
198173
{{ t('title') }}
199174
</h1>
200-
201-
<n-button mx-2 text size="small" circle @click="layoutStore.toggleSidebar">
202-
<template #icon>
203-
<NIcon size="1.2rem" color="#888">
204-
<CollapsedIcon v-if="collapsed" />
205-
<PinnedIcon v-else />
206-
</NIcon>
207-
</template>
208-
</n-button>
209175
</div>
210176
</div>
211177
<n-menu

src/layouts/home.vue

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,3 @@ const collapsed = ref(false)
1818
</n-layout-content>
1919
</n-layout>
2020
</template>
21-
22-
<style lang="scss">
23-
// .n-layout-content {
24-
// height: 100vh !important;
25-
// }
26-
// .main {
27-
// // padding-left: var(--sidebar-width);
28-
// padding-right: 1rem;
29-
// transition: all 0.3s ease-in;
30-
31-
// &.sidebar-collapsed {
32-
// padding-left: 5rem;
33-
// padding-right: 1rem;
34-
// }
35-
// }
36-
37-
// .rtl {
38-
// .main {
39-
// padding-right: var(--sidebar-width);
40-
// padding-left: 1rem;
41-
42-
// &.sidebar-collapsed {
43-
// padding-right: 5rem;
44-
// padding-left: 1rem;
45-
// }
46-
// }
47-
// }
48-
</style>

0 commit comments

Comments
 (0)