feat(DropdownMenu): expose notch radius/stroke props + fix Notch border containment#314
Merged
Merged
Conversation
Contributor
|
Storybook Preview: https://mirrorstack-ai.github.io/web-ui-kit/pr/314/ |
32d3f00 to
c36ce89
Compare
…er containment DropdownMenu hardcoded the notch corner radius (16/10) and stroke width (1.5), so a notch wrapping a small trigger (e.g. an 8px icon button) always rendered an over-rounded head with a fixed border. Expose `notchRadius`, `notchInverseRadius`, and `notchStrokeWidth` — all defaulting to the existing values, so there's no behaviour change — and pass them through to the Notch. Also fix Notch stroke containment: the SVG element was sized `strokeWidth` larger than the content box and pinned top-left, so the centered stroke on the right and bottom edges rendered OUTSIDE the box. Size the element to the content box (keeping the padded viewBox) so the border sits fully inside on every edge. Adds a TightHead story demoing a notch tuned to a small icon button. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
c36ce89 to
a2a50ff
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.
What
Notch-dropdown fixes prompted by trying to wrap the
DropdownMenunotch tightly around a small (32px / 8px-radius) icon button in the marketing nav:DropdownMenu—notchRadius,notchInverseRadius, andnotchStrokeWidth. The component hardcoded the corner radius (16/10) and border width (1.5) and only exposednotchWidth/notchHeight, so a notch sized down to a small trigger still rendered an over-rounded "bulbous" head with a fixed border that couldn't match the trigger.Notchstroke containment. The SVG element was sizedstrokeWidthlarger than the content box and pinnedtop-left, so the centered stroke on the right and bottom edges rendered outside the box (left/top happened to fall just inside). Sizing the element to the content box — while keeping the-padviewBox so the stroke isn't clipped — puts the border fully inside on all four edges.How
DropdownMenu: new optionalnotchRadius/notchInverseRadius/notchStrokeWidthprops, defaulting to the existing16/10/1.5— fully backward-compatible, no behaviour change for existing callers — passed through to<Notch radius=… inverseRadius=… strokeWidth=… />.Notch: both SVGs now usewidth={svgW}/height={svgH}(the content box) instead of…+ strokeWidth; the paddedviewBoxis unchanged, so the centered stroke scales to sit fully inside the box. Verified against the raw path geometry (right/bottom strokes move from outside → inside the content box; left/top unaffected) and theNotch.test.tsxdimension specs updated accordingly (+ newviewBoxassertions that lock in the containment).TightHeadstory showing a notch tuned to a smallsize="sm"icon button.Versioning
releaselabel applied so the release workflow publishes on merge.Risk / review
Notchis a shared primitive (also used byNotchGrid, grid-outline). The change only affects where the stroke lands (now inside the box on every edge) and shrinks the SVG element bystrokeWidth;NotchGridtests pass unchanged — please still eyeball it in Storybook. CI runs typecheck + tests + build.Adoption
web-landingto@mirrorstack-ai/web-ui-kit@0.5.11and passnotchRadius={8} notchInverseRadius={6}on the navDropdownMenuto match the icon button.🤖 Generated with Claude Code