-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
1ebfb9a
commit 7393da9
Showing
7 changed files
with
95 additions
and
13 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 was deleted.
Oops, something went wrong.
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,14 @@ | ||
.root { | ||
.content { | ||
left: var(--w); | ||
|
||
@apply transition-all duration-500; | ||
@apply fixed inset-0 overflow-hidden; | ||
} | ||
|
||
@screen phone { | ||
.content { | ||
left: var(--sidebar-collapse-width) !important; | ||
} | ||
} | ||
} |
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,32 @@ | ||
import { KBarWrapper } from '~/components/k-bar' | ||
import { cn } from '~/utils' | ||
|
||
import styles from './index.module.css' | ||
|
||
const isInApiDebugMode = | ||
localStorage.getItem('__api') || | ||
localStorage.getItem('__gateway') || | ||
sessionStorage.getItem('__api') || | ||
sessionStorage.getItem('__gateway') || | ||
window.injectData.PAGE_PROXY | ||
|
||
export const SidebarLayout = () => { | ||
return ( | ||
<KBarWrapper> | ||
<div className={styles.root}> | ||
{isInApiDebugMode ? ( | ||
<div | ||
className={cn([ | ||
'bg-dark-800 z-2 fixed left-0 right-0 top-0 flex h-[40px] items-center whitespace-pre text-gray-400 transition-all duration-500', | ||
window.injectData.PAGE_PROXY && 'bg-red-900', | ||
])} | ||
> | ||
123 | ||
</div> | ||
) : ( | ||
'' | ||
)} | ||
</div> | ||
</KBarWrapper> | ||
) | ||
} |
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,5 @@ | ||
import { createHashRouter } from 'react-router-dom' | ||
import { createBrowserRouter } from 'react-router-dom' | ||
|
||
import { routes } from './route' | ||
|
||
export const router = createHashRouter(routes) | ||
export const router = createBrowserRouter(routes) |
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,45 @@ | ||
import { createSlice } from '@reduxjs/toolkit' | ||
|
||
export interface ViewportRecord { | ||
w: number | ||
h: number | ||
mobile: boolean | ||
pad: boolean | ||
hpad: boolean | ||
wider: boolean | ||
widest: boolean | ||
phone: boolean | ||
} | ||
|
||
const initialState = { | ||
viewport: { | ||
w: 0, | ||
h: 0, | ||
mobile: false, | ||
pad: false, | ||
hpad: false, | ||
wider: false, | ||
widest: false, | ||
phone: false, | ||
}, | ||
sidebarWidth: 250, | ||
sidebarCollapse: false, | ||
isDark: false, | ||
naiveUIDark: false, | ||
} | ||
|
||
export const uiSlice = createSlice({ | ||
name: 'ui', | ||
initialState, | ||
reducers: { | ||
toggleDark(state) { | ||
state.isDark = !state.isDark | ||
}, | ||
updateViewport(state, action) { | ||
state.viewport = action.payload | ||
}, | ||
toggleSidebar(state, action) { | ||
state.sidebarCollapse = action.payload | ||
}, | ||
}, | ||
}) |