mirror of
https://github.com/projectsend/projectsend.git
synced 2026-10-08 14:21:15 +00:00
60c82afe5a
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.
34 lines
989 B
TypeScript
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>
|
|
);
|
|
}
|