AppShell.jsx 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import React from "react";
  2. import TopNav from "@/components/app-shell/TopNav";
  3. import SidebarPlaceholder from "@/components/app-shell/SidebarPlaceholder";
  4. /**
  5. * AppShell
  6. *
  7. * Purpose:
  8. * - Provide a stable frame for all protected pages:
  9. * - Top navigation (always visible)
  10. * - Optional sidebar area (desktop)
  11. * - Main content area (route pages render here)
  12. *
  13. * Layout notes:
  14. * - The outer wrapper must be `flex flex-col` so the content region can use `flex-1`
  15. * and fill the remaining viewport height below the TopNav.
  16. *
  17. * Test/runtime note:
  18. * - Our Vitest/Vite setup currently uses the "classic" JSX runtime in unit tests,
  19. * which requires React to be in scope. Importing React here ensures tests work
  20. * without introducing additional build tooling configuration.
  21. */
  22. export default function AppShell({ children }) {
  23. return (
  24. <div className="min-h-screen flex flex-col">
  25. <TopNav />
  26. {/* Content area below the top navigation */}
  27. <div className="mx-auto flex w-full max-w-7xl flex-1 gap-4 px-4 py-4">
  28. {/* Sidebar is reserved space for navigation/filter UI.
  29. We hide it on small screens for now (responsive baseline). */}
  30. <aside className="hidden w-64 shrink-0 md:block">
  31. <SidebarPlaceholder />
  32. </aside>
  33. {/* Main content: all route pages render here */}
  34. <main className="min-w-0 flex-1">{children}</main>
  35. </div>
  36. </div>
  37. );
  38. }