Skip to content

feat(SidenavBar): add first draft of the component - #1673

Draft
brtbrt wants to merge 17 commits into
masterfrom
mbertamini/1592-sidenav-bar
Draft

feat(SidenavBar): add first draft of the component#1673
brtbrt wants to merge 17 commits into
masterfrom
mbertamini/1592-sidenav-bar

Conversation

@brtbrt

@brtbrt brtbrt commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

First draft of the SidenavBar component, following the Mistica sidenav spec
(specs/sidenav.md). The goal of this PR is to agree on the public API surface
early so review can start while the internals are iterated.

Public API (compound components)

  • SidenavBar — the <nav> landmark. Props: variant, boxed, divider,
    collapsible, collapsed / defaultCollapsed / onCollapse, doublePanel,
    width / collapsedWidth, logo, header, footer, renderCollapseButton,
    aria-label, dataAttributes.
  • SidenavSection — optional title and dividerTop / dividerBottom.
  • SidenavItemlabel, Icon, selected, right, defaultOpen, nested
    children, and an exclusive onPress / href / to navigation union (an item
    may also just group children and expand).

What works in this draft

  • Collapse / expand, controlled and uncontrolled, with the default IconButton
    control (and a custom render hook).
  • Sections with title and dividers.
  • Items with asset, label, right slot, selected indicator (aria-current="page"),
    and nested items with inline expand / collapse (second focus stop on the chevron
    for items that both navigate and group).
  • Accessible collapsed view (labels preserved via ScreenReaderOnly + tooltip).
  • Unit tests, Storybook story with args / argTypes, and a Playroom snippet.

Intentionally not implemented yet (marked TODO(sidenav))

  • Collapsed dialog-panel and double-panel rendering of nested items.
  • Mobile burger-menu behaviour (reusing MainNavigationBar).
  • Content layout wrapper (whole-viewport / centered).
  • Fixed header / footer scroll-intersection dividers.
  • Per-region colour token matrices for brand / alternative / negative /
    media (only default is fully styled today; other variants still provide the
    correct ThemeVariant context to descendants).

Feedback on the API shape is very welcome before the behaviours above are built out.

Ref: 1592

brtbrt added 2 commits July 29, 2026 18:30
…tion

Define the public compound API (SidenavBar, SidenavSection, SidenavItem)
following the Mistica sidenav spec, with a working first-version render:

- Collapse/expand (controlled and uncontrolled) with a default IconButton
  control and a custom render hook.
- Sections with optional title and top/bottom dividers.
- Items with leading asset, label, optional right slot, selected indicator
  (aria-current="page"), and nested items with inline expand/collapse.
- Accessible collapsed view: labels kept via ScreenReaderOnly plus tooltip.
- variant / boxed / divider / width / doublePanel props wired to the API.

Behaviours still pending are marked with TODO(sidenav): collapsed
dialog/double panels, mobile burger menu, content layout wrapper, fixed
header/footer scroll dividers, and per-variant token matrices.

Includes unit tests, story, and a playroom snippet.

Ref: 1592
@brtbrt brtbrt added the AI AI Generated label Jul 29, 2026
@brtbrt
brtbrt requested a review from a team July 29, 2026 17:02
@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown

Size stats

master this branch diff
Total JS 15.7 MB 15.8 MB +33.8 kB
JS without icons 1.93 MB 1.95 MB +15 kB
Lib overhead 96.9 kB 96.9 kB 0 B
Lib overhead (gzip) 21.3 kB 21.3 kB 0 B

@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown

Deploy preview for mistica-web ready!

Project:mistica-web
Status: ✅  Deploy successful!
Preview URL:https://mistica-fhkdshitw-flows-projects-65bb050e.vercel.app
Latest Commit:f4bf3b0

Deployed with vercel-action

@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown

Accessibility report

4 problems detected
components-sidenavbar--default [Movistar] (1 violations)
components-sidenavbar--default [O2] (1 violations)
components-sidenavbar--default [Vivo] (1 violations)
components-sidenavbar--default [Vivo-evolution] (1 violations)

ℹ️ You can run this locally by executing yarn audit-accessibility.

brtbrt added 15 commits July 31, 2026 20:59
- Logo: 40×40 per spec (was 32×32)
- Collapse button: explicit 32×32 per spec
- Both fit cleanly in the 72px collapsed width (logo stacks vertically with button)
The IconButton with `small` prop already renders as 32×32
(icon 1.25rem + 12px padding). Explicit CSS constraints were
causing the button to appear squeezed. The button now renders
naturally without forced dimensions.
Footer region now has 24px top/bottom padding to match the header,
creating visual symmetry at the top and bottom of the sidenav.
…oter

Header and footer now use the correct color tokens per variant:
- Default: background / backgroundContainer
- Brand: backgroundBrandTop / backgroundContainerBrand
- Alternative: background / backgroundContainerAlternative
- Negative: backgroundNegative / backgroundContainerNegative
- Media: backgroundNegative / backgroundContainerNegative

Tokens are now applied via styleVariants keyed by the normalized variant prop.
Body now uses the correct backgroundContainer tokens per variant:
- Default: backgroundContainer
- Brand: transparent
- Alternative: backgroundContainerAlternative
- Negative: backgroundContainerNegative
- Media: backgroundContainerNegative

This ensures the body background matches the spec and provides visual
consistency with the header and footer regions.
…lify API

The collapse button is now always the default IconButton (later to be replaced
with a Touchable containing the sidenav-collapse/uncollapse glyphs). Removes:
- RenderCollapseButton type
- renderCollapseButton prop and parameter
- Conditional logic for custom collapse button rendering

Simplifies the component signature and header rendering.

TODO WIP: Replace IconButton with Touchable + icon when sidenav-collapse/uncollapse
icons are added to mistica-icons.
Clarifies that SidenavBar.children must be SidenavSection elements,
not arbitrary ReactNode.
Items now have proper spacing from the right edge, matching the spec's
content area padding requirement (8px left/right).
Aligns with the 10px spacing pattern used in collapsed header controls,
providing consistent spacing throughout the sidenav.
Items now have 8px base left padding plus nesting indentation, preventing
the selected indicator from touching the left edge of the sidenav.
Section container now has consistent 10px left/right padding for all content
(items, dividers, title), preventing them from touching the sidenav edges.
- Section title: 16px x padding (per spec)
- Section content (items + dividers): 10px x padding

Wraps items and dividers in a sectionContent container so they get
proper 10px left/right spacing while section title gets its own 16px.
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Screenshot tests report

icons / icons-catalog-for-blau-filled-1-snap
icons / icons-catalog-for-blau-light-1-snap
icons / icons-catalog-for-blau-regular-1-snap
icons / icons-catalog-for-movistar-filled-1-snap
icons / icons-catalog-for-movistar-light-1-snap
icons / icons-catalog-for-movistar-regular-1-snap
icons / icons-catalog-for-o-2-filled-1-snap
icons / icons-catalog-for-o-2-light-1-snap
icons / icons-catalog-for-o-2-regular-1-snap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI AI Generated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant