feat: add condensed view for text & data display components#146
Conversation
Add a Storybook toolbar density selector (Standard/Condensed) that toggles a 'condensed' CSS class on the iframe body, enabling pure-CSS density overrides for maximum information density on screen. Storybook toolbar: - Add density globalType with collapse icon and Standard/Condensed options - Add initialGlobals for density (Storybook 10 format) - Toggle body.condensed class in applyGlobalTheme decorator Components updated with data-slot attributes: - Badge, CountBadge, Avatar, InventoryManager, PatientHeader - ProviderUsersTable (+ RowActionsMenu overflow menu refactor) - Card, ServiceCard, AddServiceCard, ServiceGrid - StripeBadge, StripeSecureBadge - Timeline (TimelineProgress, TimelineEventList, OrderConfirmation) - AGGrid Condensed CSS overrides in base.css (body.condensed selectors): - Reduced padding, font sizes, border-radius across all components - Tighter grid gaps for ServiceGrid - Smallfeat: add condensed density view for medical prws Add a Storybook toolbar density selector (Standard/Condenser a 'condensed' CSS class on the iframe body, enabling pure-CSS density oveevoverrides for maximum information density on s card layout
There was a problem hiding this comment.
Pull request overview
Adds a Storybook-level “Density” toggle (Standard/Condensed) that applies a condensed class to the preview iframe body, enabling scoped CSS overrides for a higher-density “medical professional” UI view.
Changes:
- Add Storybook
densityglobal +initialGlobals, and togglebody.condensedfrom the preview decorator. - Introduce extensive
body.condensed …overrides insrc/styles/base.cssfor many components. - Add
data-slotattributes to multiple components to provide stable CSS hooks for condensed overrides.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/styles/base.css |
Adds condensed-density CSS overrides scoped under body.condensed and data-slot hooks. |
src/components/Timeline/Timeline.tsx |
Adds data-slot hooks for condensed styling of timeline subcomponents. |
src/components/StripeBadge/StripeBadge.tsx |
Adds data-slot hooks for condensed styling of Stripe badges. |
src/components/ServiceGrid/ServiceGrid.tsx |
Adds data-slot hook for condensed grid spacing overrides. |
src/components/ServiceCard/ServiceCard.tsx |
Adds data-slot hooks and adjusts AddServiceCard min-height (now affects all densities). |
src/components/ProviderUsersTable/ProviderUsersTable.tsx |
Adds data-slot hook and refactors row actions into an overflow menu. |
src/components/PatientHeader/PatientHeader.tsx |
Adds data-slot hook for condensed header overrides. |
src/components/InventoryManager/InventoryManager.tsx |
Adds data-slot hook for condensed layout overrides. |
src/components/CountBadge/CountBadge.tsx |
Adds data-slot hooks (and replaces prior data-count-badge attribute). |
src/components/Card/Card.tsx |
Adds data-slot hook so condensed styles can target Card consistently. |
src/components/Badge/Badge.tsx |
Adds data-slot hook for condensed badge overrides. |
src/components/Avatar/Avatar.tsx |
Adds data-slot hooks for condensed avatar + avatar-group overrides. |
src/components/AGGrid/AGGrid.tsx |
Adds data-slot hook for condensed AG Grid overrides. |
.storybook/preview.tsx |
Adds density globals + toggles body.condensed from Storybook globals. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ck-outside by open state, revert AddServiceCard min-height
Deploying ui with
|
| Latest commit: |
9d6a3f7
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://a026b5f7.ui-6d0.pages.dev |
| Branch Preview URL: | https://feature-condensed-view-text.ui-6d0.pages.dev |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/styles/base.css
Outdated
|
|
||
| body.condensed [data-slot='card'] { | ||
| border-radius: 0.375rem; | ||
| padding: 0.375rem !important; |
There was a problem hiding this comment.
body.condensed [data-slot='card'] forces padding: 0.375rem !important, which overrides Card's padding variants and the pl-4 left padding that Card applies when accent is set. In condensed mode this can cause accented cards to lose the left inset and have content overlap the accent bar. Consider scoping the condensed padding override so it preserves accent padding (e.g., add a follow-up rule that restores padding-left for accented cards) or avoid overriding padding on the base Card and instead target only the specific card variants/components that need condensed spacing.
| padding: 0.375rem !important; | |
| padding-top: 0.375rem !important; | |
| padding-right: 0.375rem !important; | |
| padding-bottom: 0.375rem !important; |
There was a problem hiding this comment.
Fixed in 7f7e58e. Changed the padding shorthand to directional properties (padding-top, padding-right, padding-bottom) with !important, leaving padding-left untouched. This preserves the pl-4 left inset that Card applies when the accent prop is set, so accented cards won't have content overlapping the accent bar in condensed mode.
| <Button | ||
| variant="ghost" | ||
| size="icon" | ||
| onClick={() => setOpen((v) => !v)} | ||
| aria-label="Row actions" | ||
| aria-haspopup="menu" | ||
| aria-expanded={open} | ||
| className="h-7 w-7" | ||
| > |
There was a problem hiding this comment.
RowActionsMenu's trigger uses the shared <Button> component without an explicit type. Since Button renders a native <button> and doesn't set a default type, this will default to type="submit" when rendered inside a <form>, potentially causing unintended submissions. Set type="button" on this trigger button (and any other non-submit action buttons) to make the behavior safe when embedded in forms.
There was a problem hiding this comment.
Fixed in 7f7e58e. Added type="button" to the RowActionsMenu trigger <Button> so it won't default to type="submit" when rendered inside a <form>. The menu item buttons already had type="button" set correctly.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 15 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Card: use directional padding (top/right/bottom) instead of shorthand so accent pl-4 left padding is preserved in condensed mode - ProviderUsersTable: add type="button" to RowActionsMenu trigger to prevent implicit form submission - CountBadge: add data-slot="count-badge-menu-scroll" to scroll container and update CSS selector (replaces brittle .max-h-[240px]) - PatientHeader: remove dead gap rule on non-flex space-y-2.5 container; keep working > * + * margin override - AGGrid: scrollbars now use opacity fade instead of collapsing to 0 height/width, with :focus-within fallback for keyboard/touch users - Storybook: include density in URL globals parsing so ?globals=density:condensed works on initial page load
…w-text-data-display-components
- Replace hand-rolled menu (useState, useRef, useEffect click-outside, useEscapeKey, custom role=menu div, raw button elements) with the existing Dropdown/DropdownItem/DropdownSeparator components - Gets focus management, ARIA attributes, keyboard nav, dark mode, and consistent styling for free - Add DropdownSeparator between normal and destructive actions - Remove unused imports: React, cn, useEscapeKey - Net reduction: ~65 lines of custom code Addresses Copilot review comment #7 on PR #146 (a11y regression).
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- useClickOutside: add optional 'enabled' parameter (default true); listeners only attach when enabled, reducing global listener count - Dropdown: pass isOpen to useClickOutside so listeners are only active while the menu is open (benefits all Dropdown consumers) - ProviderUsersTable: use optional chaining (onResendInvite?., onRemove?.) for strict TS safety in RowActionsMenu callbacks
Add a Storybook toolbar density selector (Standard/Condensed) that toggles a 'condensed' CSS class on the iframe body, enabling pure-CSS density overrides for maximum information density on screen.
Storybook toolbar:
Components updated with data-slot attributes:
Condensed CSS overrides in base.css (body.condensed selectors):
condensed-1.mov