Repository navigation
feat(AppShell): add XDSAppShell component - #247
Conversation
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR New ComponentsAppShell · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Component PreviewsIncludes interactive hover previews as animated GIFs. XDSAppShellGenerated by PR Enrichment workflow | Storybook | Sandbox | View full report |
| export const Default: Story = { | ||
| render: () => ( | ||
| <XDSAppShell | ||
| topNav={<MockTopNav title="My App" />} |
There was a problem hiding this comment.
Use the actual XDSTopNav
| topNav={<MockTopNav title="My App" />} | ||
| pageNav={<MockPageNav />} | ||
| topBanner={ | ||
| <div {...stylex.props(styles.banner)}> |
There was a problem hiding this comment.
Use the actual XDSBanner
| ), | ||
| }; | ||
|
|
||
| export const ControlledCollapse: Story = { |
There was a problem hiding this comment.
Hmm collapse controls need too much coordination between shell and nav
| * Breakpoint below which sidebar auto-collapses. | ||
| * @default 'md' | ||
| */ | ||
| sidebarBreakpoint?: XDSAppShellBreakpoint; |
There was a problem hiding this comment.
We have some inconsistent API language around sidebar vs page nav
There was a problem hiding this comment.
Maybe sideNav to reflect topNav below
| /** | ||
| * Optional top banner slot for system-wide announcements. | ||
| */ | ||
| topBanner?: ReactNode; |
There was a problem hiding this comment.
Could be just "banner"
|
|
||
| const observer = new ResizeObserver(entries => { | ||
| for (const entry of entries) { | ||
| setHeaderHeight(entry.contentRect.height); |
There was a problem hiding this comment.
We also need the banner height
| // ========================================================================= | ||
| const handleToggleCollapse = useCallback(() => { | ||
| const newValue = !isCollapsed; | ||
| withViewTransition(() => { |
There was a problem hiding this comment.
Let's skip for now. We need React transition support and use ViewTransitions
Application-level layout shell that provides the structural frame for an app: header, sidebar navigation, and main content area. Features: - Slot-based API: topNav, pageNav, topBanner, children - Two height modes: fill (100dvh, independent scroll) and auto (page scroll, sticky navs) - Sidebar collapse: controlled + uncontrolled patterns - Responsive sidebar collapse via sidebarBreakpoint prop - Mobile overlay sidebar with backdrop - Skip-to-content link (visually hidden, shown on focus) - ViewTransitions API for sidebar animations (graceful fallback) - Semantic HTML: header, nav, main with proper ARIA attributes - Default sidebar width: 260px Closes #185 Co-authored-by: Navi <[email protected]>
… sideNav, add real components to stories - Rename sidebar→sideNav for consistent API language (pageNav→sideNav, isSidebarCollapsed→isSideNavCollapsed, sidebarBreakpoint→sideNavBreakpoint, etc.) - Rename topBanner→banner - Compose XDSLayout internally (XDSLayoutHeader, XDSLayoutPanel, XDSLayoutContent) instead of building custom grid/flex layout - Replace MockTopNav with actual XDSTopNav in stories - Add TODO for XDSBanner once component is available - Remove CSS transitions — snap open/closed for now (ViewTransitions planned) - Add comment explaining matchMedia is event-driven and does not over-trigger - Remove unused header/banner height measurement (XDSLayout handles positioning) - Add TODO for root providers (ThemeProvider, ProseProvider, LayerProvider) - Simplify ControlledCollapse story with note about shell/nav coordination Co-authored-by: Navi <[email protected]>
Replace the placeholder banner div in the WithBanner story with the actual XDSBanner component (variant="section"), now that Banner has been merged to main. Remove the unused banner style. Co-authored-by: Navi <[email protected]>
e92d165 to
5183999
Compare
Summary
Adds
XDSAppShell— an application-level layout shell that provides the structural frame for an app: header, sidebar navigation, and main content area. Closes #185.What's included
Component:
XDSAppShellA slot-based layout shell with the following API:
childrenReactNode<main>)topNavReactNodepageNavReactNodetopBannerReactNodeheight'fill' | 'auto''fill'isSidebarCollapsedbooleaninitialIsSidebarCollapsedbooleanfalseonSidebarCollapsedChange(boolean) => voidsidebarBreakpoint'sm' | 'md' | 'lg' | 'none''md'sidebarWidthnumber260xstyleStyleXStylesFeatures
fill(100dvh, independent scroll containers) andauto(page scroll, sticky navs)<header>,<nav>(witharia-label),<main>(withrole="main")Files
packages/core/src/AppShell/XDSAppShell.tsxpackages/core/src/AppShell/XDSAppShell.test.tsxpackages/core/src/AppShell/index.tspackages/core/src/AppShell/README.mdapps/storybook/stories/AppShell.stories.tsxpackages/core/src/index.tsDesign decisions
XDSAppShell.Header)Crafted with care by Navi