Files
projectsend/resources/js/components/app-shell.tsx
T
ignacionelson 60c82afe5a Let an installed package restyle the staff area and supply its own browser icons
Core imports any stylesheet a package ships under resources/css after its
own app.css, and marks the pieces worth restyling with data attributes:
the staff shell (data-surface="staff"), the header, cards, buttons with
their variant, list toolbars, table frames and the default logo marks.
The layout takes its icons from projectsend.icons when a package names
some, replacing the defaults as a set.

Core names no package and no style. With nothing installed that ships a
stylesheet or icons, nothing renders differently.
2026-09-29 17:51:47 -03:00

34 lines
989 B
TypeScript

import { SidebarProvider } from '@/components/ui/sidebar';
import { useState } from 'react';
interface AppShellProps {
children: React.ReactNode;
variant?: 'header' | 'sidebar';
}
export function AppShell({ children, variant = 'header' }: AppShellProps) {
const [isOpen, setIsOpen] = useState(() => (typeof window !== 'undefined' ? localStorage.getItem('sidebar') !== 'false' : true));
const handleSidebarChange = (open: boolean) => {
setIsOpen(open);
if (typeof window !== 'undefined') {
localStorage.setItem('sidebar', String(open));
}
};
if (variant === 'header') {
return (
<div data-surface="staff" className="flex min-h-screen w-full flex-col">
{children}
</div>
);
}
return (
<SidebarProvider data-surface="staff" defaultOpen={isOpen} open={isOpen} onOpenChange={handleSidebarChange}>
{children}
</SidebarProvider>
);
}