feat: OnboardingArrow component for ligretto onboarding flow#595
Merged
Conversation
ce6fd7d to
b230463
Compare
Storybook |
Themezv
reviewed
Apr 15, 2026
Implements dynamic SVG arrows that visually connect two DOM elements. Arrows recompute on resize and scroll via ResizeObserver. - useElementAnchorPoints: hook tracking viewport-relative anchor points of two refs (ResizeObserver + scroll/resize listeners) - OnboardingArrow: position:fixed SVG overlay with arc and loop variants, bezier paths computed from live anchor points, arrowhead via SVG marker - 8 Storybook stories covering arc/loop, anchor variants, custom color, multiple arrows, and interactive playground Closes #594 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace fixed arc/loop variants with five tunable presets (arc, sCurve, lasso, spiral, wave) plus a function-based shape API for one-off curves. Hand-drawn look comes from an feTurbulence + feDisplacementMap filter, with roughness/bowing/seed knobs for stable jitter. Stories ported to CSF3 (Meta/StoryObj) with one story per preset, a CustomBuilder demo, and a Playground with live controls. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Switch from position:fixed to position:absolute inside a container div, so scroll no longer triggers recalculation - Compute anchor coords relative to the arrow's container rather than the viewport; drop the scroll listener - Auto-pick closest edge anchor on each side when fromAnchor/toAnchor are omitted (shortest-distance defaults) - Replace the 'shape' string-union prop with a 'path' builder-function prop; preset names dropped, preset functions still exported for direct use - Replace filled-triangle arrowhead marker with a stroked open-chevron - Drop the ':' strip from useId — not needed in React 19 - Remove className prop Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…efaults Smaller chevron marker (6×6 vs 10×10). Reframe roughness/bowing as a 0..N scale with sensible default 1: roughness now multiplies to 6 px max displacement, bowing multiplies to a 0.02 baseFrequency — the previous default expressed as a natural "1". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
14c3992 to
9217647
Compare
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
Adds the
OnboardingArrowcomponent that dynamically draws hand-drawn curved SVG arrows between two DOM elements in the Ligretto onboarding flow. Shape is fully configurable via a builder function — the caller decides what curve to draw.from/torefs, tracks their position viaResizeObserver. Renders asposition: absoluteinside its container, so scroll moves the arrow with the layout instead of triggering recalculationfromAnchor/toAnchorare omitted, each side picks the edge center closest to the other element (shortest-distance connection)pathprop is anOnboardingArrowPathBuilderfunction. Five presets are shipped as importable functions (arcPath,sCurvePath,lassoPath,spiralPath,wavePath), and consumers can pass their own custom builder for one-off shapesfeTurbulence+feDisplacementMapfilter displaces the stroke into a wobbly sketchy line. No external library (rough.js etc.).roughness,bowing,seedcontrol the jitter;seedis derived fromuseIdso the wobble stays stable across re-rendersAPI
Custom shape via function
Container requirement
The component must be rendered inside a
position: relative(or otherwise positioned) container that also contains thefrom/toelements. All anchor coordinates are computed relative to that container, which is why scrolling doesn't require a recalculation.Files
OnboardingArrow.tsxbuildPath.tsarcPath,sCurvePath,lassoPath,spiralPath,wavePath),PathBuilderArgs,computeGeometryuseElementAnchorPoints.tsResizeObserver-driven anchor tracking, container-relative coords, auto-anchor fallbackindex.tsOnboardingArrow.stories.tsxCustomBuilder,AutoAnchors,MultipleArrows,Playgroundwith live controlsWhat's next
OnboardingPage.tsxwith correctfrom/totargets per Figma layoutcurvature/twistper onboarding step to match Figma silhouettes (Vector 51064:209, Vector 61077:741, Vector 71077:742)Closes #594
🤖 Generated with Claude Code