-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
125 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './layoutResolver'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import type { RouteLocationNormalized } from 'vue-router'; | ||
import { LayoutsEnum, LayoutToFileMap } from '@/layouts/model'; | ||
|
||
export async function layoutResolverMiddleware(route: RouteLocationNormalized) { | ||
const { layout } = route.meta; | ||
const normalizedLayoutName = layout || LayoutsEnum.default; | ||
const fileName = LayoutToFileMap[normalizedLayoutName].split('.vue')[0]; | ||
const component = await import(`@/layouts/ui/${fileName}.vue`); | ||
route.meta.layoutComponent = component.default; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import AppLayout from './ui/AppLayout.vue'; | ||
import DefaultLayout from './ui/DefaultLayout.vue'; | ||
import SidebarLayout from './ui/SidebarLayout.vue'; | ||
import WelcomeLayout from './ui/WelcomeLayout.vue'; | ||
import AuthLayout from './ui/AuthLayout.vue'; | ||
|
||
export { DefaultLayout, SidebarLayout, AuthLayout }; | ||
export { AppLayout, DefaultLayout, WelcomeLayout, AuthLayout }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './types'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export enum LayoutsEnum { | ||
default = 'default', | ||
auth = 'auth', | ||
welcome = 'welcome' | ||
} | ||
|
||
export const LayoutToFileMap: Record<LayoutsEnum, string> = { | ||
default: 'DefaultLayout.vue', | ||
auth: 'AuthLayout.vue', | ||
welcome: 'WelcomeLayout.vue' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<template> | ||
<component :is="$route.meta.layoutComponent"> | ||
<slot /> | ||
</component> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,87 @@ | ||
<script setup lang="ts"> | ||
// @ts-expect-error missing type | ||
import { Splitpanes, Pane } from 'splitpanes'; | ||
import 'splitpanes/dist/splitpanes.css'; | ||
import { computed, ref } from 'vue'; | ||
import { Sidebar, HeaderMain } from '@/widgets/layout'; | ||
import { useLocalStorage } from '@vueuse/core'; | ||
import { RouteNames } from '@/shared/config/consts'; | ||
const isExpanded = useLocalStorage('isExpanded', true); | ||
const transitionFl = ref(false); | ||
const widthSidebar = computed(() => { | ||
return isExpanded.value ? '22%' : '4%'; | ||
}); | ||
const widthMainContainer = computed(() => { | ||
return `calc(100% - ${widthSidebar.value})`; | ||
}); | ||
const onToggleArea = () => { | ||
isExpanded.value = !isExpanded.value; | ||
transitionFl.value = true; | ||
}; | ||
</script> | ||
|
||
<template> | ||
<div :class="$style.default_layout"> | ||
<slot /> | ||
</div> | ||
<Splitpanes :class="$style.default_layout"> | ||
<Pane | ||
min-size="4" | ||
max-size="22" | ||
:size="widthSidebar" | ||
:style="{ transition: transitionFl && 'width .2s ease-out' }" | ||
> | ||
<Sidebar :is-expanded @on-toggle="onToggleArea" /> | ||
</Pane> | ||
<Pane :size="widthMainContainer"> | ||
<div :class="$style.main_part"> | ||
<HeaderMain /> | ||
<div :class="$style.slot" :style="{ padding: $route.name !== RouteNames.board ? '30px 45px' : '0' }"> | ||
<slot /> | ||
</div> | ||
</div> | ||
</Pane> | ||
</Splitpanes> | ||
</template> | ||
|
||
<style module lang="scss"> | ||
.default_layout { | ||
display: flex; | ||
flex-direction: row; | ||
flex: 1 1 0%; | ||
width: 100%; | ||
height: 100dvh; | ||
.main_part { | ||
display: flex; | ||
flex-direction: column; | ||
height: 100%; | ||
.slot { | ||
background-color: var(--zinc-50); | ||
position: relative; | ||
padding: 30px 45px; | ||
height: 100%; | ||
width: 100%; | ||
} | ||
} | ||
} | ||
.new_header { | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
padding: 6px 15px; | ||
width: 100%; | ||
background-color: var(--zinc-50); | ||
} | ||
:global(.dark) { | ||
.default_layout { | ||
.main_part { | ||
.slot { | ||
background-color: var(--zinc-700); | ||
} | ||
} | ||
} | ||
} | ||
</style> |
This file was deleted.
Oops, something went wrong.