diff --git a/src/data/Navigation.ts b/src/data/Navigation.ts new file mode 100644 index 00000000..2196863c --- /dev/null +++ b/src/data/Navigation.ts @@ -0,0 +1,24 @@ +import { NavigationModel, NavigationPosition } from '@/model/Navigation' +import NavigationService from '@/services/Navigation' +import { Home, LogIn, LogOut } from 'lucide-vue-next' + +const createNavigation = (): void => { + NavigationService.addNavigation(createNavigationItem('Home', undefined, '/home', Home, NavigationPosition.TOP)) + NavigationService.addNavigation(createNavigationItem('Sign In', undefined, '/auth/signin', LogIn, NavigationPosition.TOP)) + NavigationService.addNavigation(createNavigationItem('Sign Up', undefined, '/auth/signup', LogOut, NavigationPosition.BOTTOM)) +} + +const createNavigationItem = (title?: string, label?: string, href?: string, icon?: any, position?: NavigationPosition, children?: NavigationModel[]): NavigationModel => { + return { + title: title, + label: label, + href: href, + icon: icon, + position: position, + children: children + } +} + +export { + createNavigation +} diff --git a/src/data/index.ts b/src/data/index.ts new file mode 100644 index 00000000..56245cb2 --- /dev/null +++ b/src/data/index.ts @@ -0,0 +1,4 @@ +import { createNavigation } from '@/data/Navigation' + +// Import navigation data +createNavigation() diff --git a/src/main.ts b/src/main.ts index ad34f420..2ca1a7c5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -4,6 +4,9 @@ import router from '@/router' import './style.css' import './assets/index.css' +// Import mock data +import '@/data/index' + const app = createApp(App) app.use(router) app.mount('#app') diff --git a/src/model/Navigation.ts b/src/model/Navigation.ts index b90f2653..12580211 100644 --- a/src/model/Navigation.ts +++ b/src/model/Navigation.ts @@ -4,5 +4,12 @@ export interface NavigationModel label?: string href?: string icon?: any + position?: NavigationPosition children?: NavigationModel[] -} \ No newline at end of file +} + +export enum NavigationPosition +{ + TOP, + BOTTOM +} diff --git a/src/router/default.ts b/src/router/default.ts index 5bbdf76b..44c374e8 100644 --- a/src/router/default.ts +++ b/src/router/default.ts @@ -1,10 +1,19 @@ import { Router } from 'vue-router' +import LayoutContainer from '@/views/layouts/base/LayoutContainer.vue' const createDefaultRouter = (router: Router): void => { router.addRoute({ path: '/', name: 'home', - redirect: '/auth/signup' + redirect: '/home', + component: LayoutContainer, + children: [ + { + name: 'home', + path: 'home', + component: () => import('@/views/pages/home/HomeIndex.vue') + } + ] }) createHttpRouter(router) createUserRouter(router) diff --git a/src/services/Navigation.ts b/src/services/Navigation.ts index 546e7ece..c103b8df 100644 --- a/src/services/Navigation.ts +++ b/src/services/Navigation.ts @@ -2,11 +2,17 @@ import { NavigationModel } from '@/model/Navigation' class NavigationService { - getNavigation(): NavigationModel[] + private navigations: NavigationModel[] = [] + + addNavigation(navigation: NavigationModel): void { - return [] + this.navigations.push(navigation) } + getNavigation(): NavigationModel[] + { + return this.navigations + } } export default new NavigationService() diff --git a/src/views/layouts/base/LayoutContainer.vue b/src/views/layouts/base/LayoutContainer.vue new file mode 100644 index 00000000..a52e0e2e --- /dev/null +++ b/src/views/layouts/base/LayoutContainer.vue @@ -0,0 +1,33 @@ + + + diff --git a/src/views/layouts/base/components/LayoutHeader.vue b/src/views/layouts/base/components/LayoutHeader.vue new file mode 100644 index 00000000..4bccc975 --- /dev/null +++ b/src/views/layouts/base/components/LayoutHeader.vue @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/src/views/layouts/base/components/LayoutSidebar.vue b/src/views/layouts/base/components/LayoutSidebar.vue index de353781..54f23d0a 100644 --- a/src/views/layouts/base/components/LayoutSidebar.vue +++ b/src/views/layouts/base/components/LayoutSidebar.vue @@ -62,6 +62,7 @@ export default defineComponent({ setIsCollapsed(opened: boolean) { this.isCollapsed = opened + this.$emit('changeCollapsed', opened) } } }) diff --git a/src/views/layouts/base/components/components/NavigationClosed.vue b/src/views/layouts/base/components/components/NavigationClosed.vue index ab97b0f6..8e251093 100644 --- a/src/views/layouts/base/components/components/NavigationClosed.vue +++ b/src/views/layouts/base/components/components/NavigationClosed.vue @@ -1,19 +1,27 @@