fix: correct default sidebar state initialization and adjust sidebar width
This commit is contained in:
@@ -45,8 +45,9 @@ export function AppShell({ children }: AppShellProps) {
|
|||||||
const currentPath = routerState.location.pathname;
|
const currentPath = routerState.location.pathname;
|
||||||
|
|
||||||
// Controlled open state (spec: "Controlled Sidebar" pattern)
|
// Controlled open state (spec: "Controlled Sidebar" pattern)
|
||||||
|
// Default to collapsed (false) until the persisted preference loads
|
||||||
const [open, setOpen] = useState(() =>
|
const [open, setOpen] = useState(() =>
|
||||||
collapsedQuery.data === undefined ? true : !collapsedQuery.data
|
collapsedQuery.data === undefined ? false : !collapsedQuery.data
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleOpenChange = (value: boolean) => {
|
const handleOpenChange = (value: boolean) => {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import {
|
|||||||
|
|
||||||
const SIDEBAR_COOKIE_NAME = "sidebar_state"
|
const SIDEBAR_COOKIE_NAME = "sidebar_state"
|
||||||
const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7
|
const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7
|
||||||
const SIDEBAR_WIDTH = "16rem"
|
const SIDEBAR_WIDTH = "12rem"
|
||||||
const SIDEBAR_WIDTH_MOBILE = "18rem"
|
const SIDEBAR_WIDTH_MOBILE = "18rem"
|
||||||
const SIDEBAR_WIDTH_ICON = "3rem"
|
const SIDEBAR_WIDTH_ICON = "3rem"
|
||||||
const SIDEBAR_KEYBOARD_SHORTCUT = "b"
|
const SIDEBAR_KEYBOARD_SHORTCUT = "b"
|
||||||
|
|||||||
Reference in New Issue
Block a user