feat(condensed): add condensed view to Overlays & Layering components#154
Conversation
…ntSwitch toggle geometry - Add 26 data-slots across all 6 exported sub-components: DialogOverlay, BookingDialog, FloatingInput, ServiceSelect, ConsentSwitch, InlineBookingForm, QuickBookCard - Add ~170 lines of condensed CSS overrides: reduced padding, smaller fonts, compact inputs, tighter grids/gaps, smaller buttons/pills - Fix ConsentSwitch toggle: remove border-2 border-transparent that ate internal space, add items-center, use translate-x-0.5 unchecked inset (matching Switch component geometry), fix condensed thumb translate values (0.125rem/0.875rem) for both checked and unchecked states
There was a problem hiding this comment.
Pull request overview
Adds condensed-density styling hooks to the BookingDialog component suite by introducing data-slot attributes and corresponding condensed CSS overrides, and refines ConsentSwitch toggle geometry to better match the shared Switch component.
Changes:
- Added
data-slotattributes across BookingDialog-related subcomponents (DialogOverlay, BookingDialog, FloatingInput, ServiceSelect, ConsentSwitch, InlineBookingForm, QuickBookCard). - Added condensed-mode CSS overrides in
condensed-view.cssto reduce spacing, font sizes, and control dimensions for these components. - Updated ConsentSwitch toggle/thumb classes and condensed translations to align with proven Switch geometry.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/styles/condensed-view.css | Adds condensed overrides targeting new BookingDialog data-slot hooks. |
| src/components/BookingDialog/BookingDialog.tsx | Adds data-slot hooks across subcomponents and adjusts ConsentSwitch toggle geometry. |
Comments suppressed due to low confidence (2)
src/components/BookingDialog/BookingDialog.tsx:405
- DialogOverlay renders a custom modal container but doesn’t currently implement common dialog accessibility behaviors used elsewhere in the repo (e.g., Escape-to-close and focus trapping/initial focus). Consider either reusing the shared
Modalcomponent (which already handlesuseEscapeKey+ focus trap), or add equivalent Escape handling and focus management here so keyboard users aren’t stranded behind the overlay.
return (
<div className="fixed inset-0 z-50 overflow-y-auto">
<div className="flex min-h-full items-center justify-center p-4">
{/* Backdrop */}
<div
className="fixed inset-0 bg-black/50 transition-opacity"
onClick={onClose}
aria-hidden="true"
/>
{/* Dialog Content */}
<div
className={cn(
'bg-card relative w-full max-w-lg transform rounded-2xl shadow-2xl transition-all',
className
)}
role="dialog"
aria-modal="true"
aria-labelledby={titleId}
data-slot="dialog-overlay"
>
{children}
</div>
</div>
</div>
src/components/BookingDialog/BookingDialog.tsx:196
- ServiceSelect’s trigger button toggles a popup list but is missing basic ARIA state wiring (e.g.,
aria-expandedand anaria-controlsreference to the dropdown). Adding these (and giving the popup an appropriate role/id) will improve screen reader output and align better with how interactive popovers are typically exposed.
<button
type="button"
onClick={() => setIsOpen(!isOpen)}
data-slot="service-select-trigger"
className={cn(
'w-full rounded-lg border px-4 py-3 text-left transition-colors',
'bg-background',
'focus:ring-2 focus:outline-none',
error
? 'border-destructive focus:ring-destructive/20'
: 'border-input focus:border-primary-500 focus:ring-primary-500/20'
)}
>
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- CookieConsent: 9 data-slots across CookieConsentBanner and CompactCookieBanner with condensed CSS for reduced padding, smaller text, compact buttons - Modal: 6 data-slots across Modal, ModalHeader, ModalTitle, ModalClose, ModalBody, ModalFooter with condensed CSS for tighter padding, smaller title, compact close button, reduced body font-size (0.75rem) and line-height
Deploying ui with
|
| Latest commit: |
cf8dff9
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://5600c64d.ui-6d0.pages.dev |
| Branch Preview URL: | https://feature-condensed-view-overl.ui-6d0.pages.dev |
Wire up aria-describedby on the switch button when description prop is present, matching the shared Switch component's accessibility pattern.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add 5 data-slots: rejection-modal-info, rejection-modal-warning, rejection-modal-reasons, rejection-modal-reason, rejection-modal-details - Add ~80 lines condensed CSS: tighter info/warning boxes, smaller text, compact reason radio options, compact textarea - Inherits Modal condensed overrides (header, body, footer) automatically
Add 6 data-slots to SetupServiceModal for condensed view targeting: - setup-service-error: error message box - setup-service-description: description label + textarea - setup-service-price: price label + currency input - setup-service-toggles: toggles container - setup-service-toggle: individual toggle rows (x3) - setup-service-inventory: conditional inventory sub-field Add ~73 lines condensed CSS with reduced padding, font sizes, and spacing. Inherits Modal, Button, Input, Select, Switch condensed overrides.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add data-slot='tooltip' to the portaled tooltip content container. Add condensed CSS: reduced padding (0.25rem 0.5rem), smaller font (0.625rem), tighter line-height, and smaller border-radius.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (4)
src/components/Modal/Modal.tsx:272
ModalHeadersetsdata-slotbut then spreads{...props}after it, which allows consumers to override/remove the slot hook (e.g. passingdata-slotvia props), breaking condensed-view selectors. Consider spreading props beforedata-slot, or explicitly strippingdata-slotfrom...propsso the slot hook remains stable.
const ModalHeader = React.forwardRef<HTMLDivElement, ModalHeaderProps>(
({ className, ...props }, ref) => (
<div
ref={ref}
data-slot="modal-header"
className={cn(
'flex shrink-0 items-center justify-between',
'border-border border-b px-6 py-4',
className
)}
{...props}
/>
src/components/Modal/Modal.tsx:300
- Same stability concern for
ModalTitle:data-slotis set but{...props}is spread after, so a consumer-provideddata-slotcan override it and break condensed-view targeting. Consider moving{...props}beforedata-slot(or strippingdata-slotfrom props).
const ModalTitle = React.forwardRef<HTMLHeadingElement, ModalTitleProps>(
({ className, children, ...props }, ref) => {
const { modalId } = useModalContext();
return (
<h2
ref={ref}
id={`${modalId}-title`}
data-slot="modal-title"
className={cn(
'text-lg leading-none font-semibold tracking-tight',
className
)}
{...props}
>
src/components/Modal/Modal.tsx:347
- Same stability concern for
ModalClose:data-slotis set but{...props}is spread after, so a consumer-provideddata-slotcan override it and break condensed-view targeting. Consider moving{...props}beforedata-slot(or strippingdata-slotfrom props).
return (
<button
ref={ref}
type="button"
onClick={handleClick}
data-slot="modal-close"
className={cn(
'inline-flex h-8 w-8 items-center justify-center rounded-lg',
'text-muted-foreground hover:text-foreground',
'hover:bg-muted transition-colors',
'focus-visible:ring-ring focus-visible:ring-2 focus-visible:outline-none',
className
)}
aria-label="Close"
{...props}
>
src/components/Modal/Modal.tsx:398
- Same stability concern for
ModalFooter:data-slotis set but{...props}is spread after, so a consumer-provideddata-slotcan override it and break condensed-view targeting. Consider moving{...props}beforedata-slot(or strippingdata-slotfrom props).
const ModalFooter = React.forwardRef<HTMLDivElement, ModalFooterProps>(
({ className, ...props }, ref) => (
<div
ref={ref}
data-slot="modal-footer"
className={cn(
'flex shrink-0 items-center justify-end gap-3',
'border-border border-t px-6 py-4',
className
)}
{...props}
/>
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Add condensed view support (data-slot attributes + condensed CSS overrides) to all Overlays & Layering components.
Components Updated
Additional Fixes
border-2 border-transparenteating internal space, addeditems-center, fixed translate values for proper unchecked/checked inset positioningaria-describedbylinking to description paragraph when presentPattern
data-slot="component-part"attributes on JSX elementsbody.condensed [data-slot='x'] { ... !important; }rules insrc/styles/condensed-view.css!importantrequired because Tailwind CSS 4's@layer utilitieslowers specificity