Skip to content

Align menubar to architecture goals#183

Open
lifeiscontent wants to merge 2 commits into
mainfrom
align/menubar
Open

Align menubar to architecture goals#183
lifeiscontent wants to merge 2 commits into
mainfrom
align/menubar

Conversation

@lifeiscontent

Copy link
Copy Markdown
Collaborator

Closes #133

What changed

The designer's spec (issue #133) distinguishes:

Always the same (baked in, not configurable by the consumer):

  • Horizontal layout, item height (h-7), and inline padding (px-2.5)
  • Font style (text-13 text-secondary)
  • Active/hover background highlight when the popup is open (data-popup-open:bg-layer-transparent-hover)
  • Rounded shape (rounded-sm) and focus outline removal (outline-none)

Depends / adjustable (supplied by the consumer at each use site):

  • The label text for each top-level menu item
  • Submenu content per item
  • Disabled items
  • Whether items carry icons

Before this change, the "always the same" trigger styles lived as a raw triggerClass string constant duplicated in both the UI-tier and components-tier stories. There was no first-class part for the menubar item trigger.

Architecture changes

  • New part MenubarTrigger (packages/propel/src/ui/menubar/menubar-trigger.tsx): wraps BaseMenu.Trigger and applies menubarTriggerVariants(). No className or style prop is exposed — styling lives entirely in CVA. This follows the same pattern as ToolbarButton.
  • New menubarTriggerVariants in variants.ts: a zero-axis CVA call that holds all the "always the same" classes in one place. Uses cx for multi-line grouping.
  • ui/menubar/index.tsx exports MenubarTrigger and MenubarTriggerProps.
  • Both stories (ui/menubar/menubar.stories.tsx, components/menubar/menubar.stories.tsx) now use <MenubarTrigger> directly, dropping the manual triggerClass constant and the now-unused MenuTrigger import. MenubarTrigger is added to each story's subcomponents map.

The components-tier index.tsx already does export * from "../../ui/menubar", so MenubarTrigger is available at both import depths without any further change.

Notes

vp check --fix reports no lint, type, or format errors across all 7 changed files.

Needs design approval from @bhaveshraja before merging.

@github-actions

Copy link
Copy Markdown

📚 Storybook preview: https://pr-183-propel-storybook.vamsi-906.workers.dev

Per the designer's spec (issue #133), the menubar item trigger's height,
padding, font style, and popup-open highlight are all "always the same". Move
them out of the stories' manual triggerClass string and into a proper
MenubarTrigger ui part backed by menubarTriggerVariants in variants.ts.

Export MenubarTrigger from the ui and components index; update both story tiers
to use it (dropping the now-unnecessary triggerClass constant and the now-unused
MenuTrigger import). Also adds MenubarTrigger to each story's subcomponents map.
The trigger was a single styled element with raw text children, leaving the
designer's adjustable "whether items have icons" axis (issue #133) with nowhere
to live — a consumer would have had to drop unstyled markup inside the trigger.

Mirror the accordion exemplar: make MenubarTrigger a flex row that composes its
anatomy parts, and add two single-element ui parts backed by their own cva:
- MenubarTriggerIcon — the optional decorative leading icon slot (node-slot
  sizing to the trigger's --node-size; aria-hidden), the icon axis.
- MenubarTriggerLabel — the trigger's label (truncates).

Bake the remaining "always the same" chrome into menubarTriggerVariants (height,
padding, gap, font, focus ring, popup-open + disabled states). Export both new
parts and compose them in the UI and components stories, registering them in the
subcomponents maps. No styling lives in the components tier.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Menu bar: what should always look the same, and what should be adjustable?

1 participant