app-shell.tsx (1116B)
1 import m from 'mithril'; 2 import { Nav, type NavItem } from '@component/nav'; 3 import { MobileNav } from '@component/mobile-nav'; 4 5 interface AppShellAttrs { 6 topbar: m.Children; 7 navLabel: string; 8 navAriaLabel: string; 9 navItems: NavItem[]; 10 accountPanel?: m.Children; 11 mobileNavOpen: boolean; 12 onMobileNavClose: () => void; 13 } 14 15 export const AppShell: m.Component<AppShellAttrs> = { 16 view({ attrs, children }) { 17 return ( 18 <div class="app-shell"> 19 {attrs.topbar} 20 <div class="app"> 21 <aside class="sidebar"> 22 <Nav 23 label={attrs.navLabel} 24 ariaLabel={attrs.navAriaLabel} 25 items={attrs.navItems} 26 /> 27 </aside> 28 <div class="main"> 29 <main class="content">{children}</main> 30 </div> 31 </div> 32 <MobileNav 33 label={attrs.navLabel} 34 ariaLabel={attrs.navAriaLabel} 35 items={attrs.navItems} 36 accountPanel={attrs.accountPanel} 37 open={attrs.mobileNavOpen} 38 onClose={attrs.onMobileNavClose} 39 /> 40 </div> 41 ); 42 }, 43 };