Align menubar to architecture goals#183
Open
lifeiscontent wants to merge 2 commits into
Open
Conversation
|
📚 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.
fb712d5 to
1bc1bd2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #133
What changed
The designer's spec (issue #133) distinguishes:
Always the same (baked in, not configurable by the consumer):
h-7), and inline padding (px-2.5)text-13 text-secondary)data-popup-open:bg-layer-transparent-hover)rounded-sm) and focus outline removal (outline-none)Depends / adjustable (supplied by the consumer at each use site):
Before this change, the "always the same" trigger styles lived as a raw
triggerClassstring constant duplicated in both the UI-tier and components-tier stories. There was no first-class part for the menubar item trigger.Architecture changes
MenubarTrigger(packages/propel/src/ui/menubar/menubar-trigger.tsx): wrapsBaseMenu.Triggerand appliesmenubarTriggerVariants(). NoclassNameorstyleprop is exposed — styling lives entirely in CVA. This follows the same pattern asToolbarButton.menubarTriggerVariantsinvariants.ts: a zero-axis CVA call that holds all the "always the same" classes in one place. Usescxfor multi-line grouping.ui/menubar/index.tsxexportsMenubarTriggerandMenubarTriggerProps.ui/menubar/menubar.stories.tsx,components/menubar/menubar.stories.tsx) now use<MenubarTrigger>directly, dropping the manualtriggerClassconstant and the now-unusedMenuTriggerimport.MenubarTriggeris added to each story'ssubcomponentsmap.The components-tier
index.tsxalready doesexport * from "../../ui/menubar", soMenubarTriggeris available at both import depths without any further change.Notes
vp check --fixreports no lint, type, or format errors across all 7 changed files.Needs design approval from @bhaveshraja before merging.