diff --git a/docs/layout-and-navigation/app-sidebar.md b/docs/layout-and-navigation/app-sidebar.md index 97ef00f1..31096472 100644 --- a/docs/layout-and-navigation/app-sidebar.md +++ b/docs/layout-and-navigation/app-sidebar.md @@ -43,7 +43,7 @@ Inside a panel `AppLayout` (the default) the sidebar uses `surface="shell"`: Pro - **`action`**: the main call to action under the header, as a full-width 44px button (Proton's "New message"). Collapsed to icons, only its icon shows; the label stays its accessible name. - **Count pills**: numeric badges are brand-coloured pills for unread-like counts, read as "12 new" by screen readers. Set `badgeTone: "neutral"` on an item for a plain muted total, read as the number alone. - **Folders and labels**: give an item a `color`. With a semantic icon (`icon: "folder"`) the icon is tinted; with no icon it shows a coloured dot. The colour is decorative; the label carries the meaning. -- **Header and footer**: put a `Logo` in `header`, with an [`ActionMenu`](../overlays/action-menu) of the suite's apps next to it if there is one, and a quota bar ([`ProgressBar`](../loading/progress-bar) with a link) or a `UserProfile` in `footer`. +- **Header and footer**: put a `Logo` in `header`, with an [`ActionMenu`](../overlays/action-menu) of the suite's apps next to it if there is one, and a quota bar ([`ProgressBar`](../loading/progress-bar) with a link) or a `UserProfile` in `footer`. Collapsed to icons, the header and footer are an icon wide: a `Logo` shows only its mark and a `UserProfile` only its avatar, and anything else that doesn't fit is clipped. Hide content that has no icon form, such as the quota bar or the app switcher, with `className="group-data-[collapsible=icon]:hidden"`. ```tsx { expect(within(menu).getByRole("menuitem", { name: "Locked" })).toHaveAttribute("aria-disabled", "true") }) + it("fits a Logo and a UserProfile into the header and footer when collapsed to icons", () => { + renderSidebar( + } + footer={} + />, + {}, + false, + ) + const header = document.querySelector("[data-slot=sidebar-header]")! + const footer = document.querySelector("[data-slot=sidebar-footer]")! + expect(header).toHaveClass("group-data-[collapsible=icon]:overflow-hidden") + expect(header).toHaveClass("group-data-[collapsible=icon]:[&_[data-slot=logo-text]]:sr-only") + expect(header.querySelector("[data-slot=logo-text]")).toHaveTextContent("Onu Admin") + expect(footer).toHaveClass("group-data-[collapsible=icon]:overflow-hidden") + expect(footer).toHaveClass("group-data-[collapsible=icon]:[&_[data-slot=user-profile-text]]:hidden") + expect(screen.getByRole("button", { name: /Aishath Shifa/ })).toHaveAttribute("data-part", "user-profile") + }) + it("toggles with the sidebar trigger and Ctrl+B", async () => { renderSidebar() const sidebar = document.querySelector("[data-slot=sidebar]")! diff --git a/packages/onu/src/components/layout/app-sidebar.tsx b/packages/onu/src/components/layout/app-sidebar.tsx index 15393996..2789467c 100644 --- a/packages/onu/src/components/layout/app-sidebar.tsx +++ b/packages/onu/src/components/layout/app-sidebar.tsx @@ -98,6 +98,21 @@ export interface AppSidebarProps extends Omit {header || action ? ( {header} {action ? ( @@ -494,7 +513,13 @@ export function AppSidebar({ {children} - {footer ? {footer} : null} + {footer ? ( + + {footer} + + ) : null} {rail ? : null} ) diff --git a/packages/onu/src/components/layout/logo.tsx b/packages/onu/src/components/layout/logo.tsx index d249aede..b7c8c858 100644 --- a/packages/onu/src/components/layout/logo.tsx +++ b/packages/onu/src/components/layout/logo.tsx @@ -82,7 +82,11 @@ export function Logo({ const content = ( <> {mark} - {text ? {text} : null} + {text ? ( + + {text} + + ) : null} ) diff --git a/plugins/onu/.claude-plugin/plugin.json b/plugins/onu/.claude-plugin/plugin.json index ea970e68..44620aca 100644 --- a/plugins/onu/.claude-plugin/plugin.json +++ b/plugins/onu/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "onu", "description": "Build UI with Onu (@javaabu/onu): the rules for writing Onu code, and the component docs through the Onu MCP server.", - "version": "0.3.0", + "version": "0.3.1", "author": { "name": "Javaabu Pvt. Ltd.", "url": "https://javaabu.com" diff --git a/web/src/pages/_shared/shells.tsx b/web/src/pages/_shared/shells.tsx index 509333c5..7f4439fe 100644 --- a/web/src/pages/_shared/shells.tsx +++ b/web/src/pages/_shared/shells.tsx @@ -239,7 +239,7 @@ export function AdminShell({ } footer={ -
+
+ } @@ -136,7 +141,7 @@ function ShellDemo() { }, ]} footer={ -
+