REFERENCE
- Gallery page: https://magpui.com/en/i/commute-card-with-transport-switch-71fdbb
- First frame (image): https://dnioievkvxejjbxgwvko.supabase.co/storage/v1/object/public/media/commute-card-with-transport-switch-71fdbb/shot.jpg
- Clip (mp4): https://dnioievkvxejjbxgwvko.supabase.co/storage/v1/object/public/media/commute-card-with-transport-switch-71fdbb/clip.mp4
- Original post: https://x.com/dev_ya/status/2119989369163723169 by @dev_ya
Before building, download the first frame and look at it. If ffmpeg is available, download the clip and extract frames (ffmpeg -i clip.mp4 -vf fps=2 frame-%02d.png), then study the motion frame by frame. Match what you see; the text below describes it, the frames are the truth.
BUILD: Build one compact commute card with four transport tabs: Drive, Transit, Walk and Bike. Switching tabs updates a large duration, arrival time, route line and bottom route notes in place. Keep the interaction quiet and readable.
DESIGN SYSTEM: Use an approximately 360px wide white card, 24px corner radius, 20px padding and a soft diffuse shadow on a pale gray-green #EFF1EC surface. Use a neutral sans-serif, 14px destination heading, 12px secondary address, 50px duration numerals and 14px minute suffix. Text is near-black #191E19, muted text #92978F, route accent #326CEC. Place a four-column segmented control on #F2F2EF with an elevated white active pill and small monochrome transport icons. Duration sits left, right-aligned arrival time opposite. Below, span a route line between a hollow start dot and filled destination dot; use solid blue for drive and bike, dotted blue for walking, and a short central blue segment with gray dotted connectors for transit. Finish with route name left and a muted contextual note right; bike can show a tiny pale-blue fastest badge.
MOTION: Suggested implementation timings: on selection, move the active pill using shared-layout transforms over 260ms with cubic-bezier(0.22,1,0.36,1). Roll duration digits vertically within clipped individual columns over 320ms; crossfade arrival and route labels over 180ms. Redraw route geometry using SVG pathLength and opacity over 300ms, without moving the endpoint dots. Give the selected icon a restrained 200ms translation or rotation suited to its transport mode; no perpetual decorative loop.
SECTIONS: Destination and address header with a muted departure label; transport tablist; duration and arrival row; route visualization; contextual footer. Four mutually exclusive active states preserve identical card dimensions. Include visible hover, pressed and keyboard-focus states. Example durations: drive 16, transit 21, walk 49, bike 15 minutes.
IMPLEMENTATION: Use React and Motion for the shared active pill, clipped number transitions and SVG route updates. Use SVG icons rather than image assets. Keep text as accessible DOM content and announce the updated trip summary politely. Implement tablist keyboard navigation, focus-visible outlines and selected semantics. For prefers-reduced-motion update immediately or use a short opacity fade without rolling digits or icon movement. Animate only transforms, opacity and one small SVG; avoid layout thrashing.
ADAPT TO THE PROJECT: Reuse the existing design tokens, components and fonts; map colors to the closest existing tokens. Never copy logos, brand names, photos or illustrations from the original; use placeholder destinations and route labels.
SUCCESS CHECK:
- All four tabs update duration, arrival, line style and route notes consistently.
- Card dimensions and endpoint positions remain stable through every transition.
- Keyboard controls, focus indication and reduced-motion mode work without hiding trip information.