Skip to content

Commit 239861d

Browse files
committed
feat(client): redesign animations with a shared motion system
- Replace motion variants with shared easing/duration/spring tokens plus editorial variants (maskReveal, imageReveal, lineGrow, staggerSlow) - Rebuild the home hero: masked headline reveal, clip-path photo reveal with scroll parallax, floating "this week's roast" card, origins marquee - Restyle features strip, new arrivals header and subscription CTA with scroll-triggered reveals - Navbar: animated link underlines, scroll shadow, badge pop on count change - Product cards: smoother lift, slower image zoom, hover overlay - New AuthLayout for login/register with image panel and staggered entrance - Product detail image reveal, animated checkmark on payment success, staggered admin dashboard cards, shimmer skeletons - Respect prefers-reduced-motion globally via MotionConfig - Refresh README screenshots and add a home collection screenshot Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SqUvyXKDeTgu2vbcVC8uTQ
1 parent 0dea07c commit 239861d

24 files changed

Lines changed: 715 additions & 421 deletions

‎README.md‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@
1919

2020
### Storefront
2121

22-
![Rostid storefront home page](docs/screenshots/home.png)
22+
![Rostid storefront hero with masked headline reveal and origins marquee](docs/screenshots/home.png)
23+
24+
### New arrivals & subscriptions
25+
26+
![Rostid home page product collection and subscription call-to-action](docs/screenshots/home-collection.png)
2327

2428
### Product browsing
2529

@@ -31,7 +35,7 @@
3135

3236
### Authentication
3337

34-
![Rostid sign-in page](docs/screenshots/login.png)
38+
![Rostid sign-in page with editorial image panel](docs/screenshots/login.png)
3539

3640
### Admin dashboard
3741

@@ -55,7 +59,7 @@
5559
| Layer | Tech |
5660
|---|---|
5761
| Frontend | React 18, TypeScript, Vite, Tailwind CSS |
58-
| Animations | Framer Motion |
62+
| Animations | Framer Motion (shared motion tokens, reduced-motion aware) |
5963
| State | Zustand, React Query v5 |
6064
| Routing | React Router v6 (lazy-loaded, code-split) |
6165
| Backend | Node.js, Express, TypeScript |
@@ -199,6 +203,7 @@ make typecheck # TypeScript check both packages
199203
- Sentry error monitoring on both server and client
200204
- PWA-ready: favicon, web manifest, Open Graph and Twitter meta tags
201205
- Accessibility: skip-to-content, focus trap in modals, aria-labels, 44px touch targets
206+
- Motion system: shared easing/duration tokens, masked headline reveals, clip-path image reveals, scroll parallax, and a global `MotionConfig reducedMotion="user"` so every animation respects `prefers-reduced-motion`
202207

203208
---
204209

‎client/src/App.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useEffect, useState } from 'react';
22
import { RouterProvider } from 'react-router-dom';
33
import { Toaster } from 'react-hot-toast';
4+
import { MotionConfig } from 'framer-motion';
45
import { router } from './router';
56
import { useAuthStore } from './store/authStore';
67
import { refreshSession, fetchMe } from './api/auth.api';
@@ -33,7 +34,7 @@ export default function App() {
3334
}
3435

3536
return (
36-
<>
37+
<MotionConfig reducedMotion="user">
3738
<RouterProvider router={router} />
3839
<Toaster
3940
position="bottom-right"
@@ -56,6 +57,6 @@ export default function App() {
5657
},
5758
}}
5859
/>
59-
</>
60+
</MotionConfig>
6061
);
6162
}

‎client/src/animations/variants.ts‎

Lines changed: 89 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,119 @@
1-
import type { Variants } from 'framer-motion';
1+
import type { Transition, Variants } from 'framer-motion';
2+
3+
/*
4+
* Motion tokens — keep in sync with design-system/MASTER.md.
5+
* One easing family everywhere: a soft "expo-out" for entrances and a quick
6+
* ease-in for exits (exits run at ~60% of the entrance duration).
7+
*/
8+
export const ease = {
9+
out: [0.16, 1, 0.3, 1],
10+
inOut: [0.65, 0, 0.35, 1],
11+
in: [0.4, 0, 1, 1],
12+
} as const;
13+
14+
export const duration = {
15+
fast: 0.18,
16+
base: 0.35,
17+
slow: 0.6,
18+
crawl: 0.9,
19+
} as const;
20+
21+
export const spring = {
22+
press: { type: 'spring', stiffness: 420, damping: 30 },
23+
gentle: { type: 'spring', stiffness: 160, damping: 24 },
24+
} satisfies Record<string, Transition>;
25+
26+
/** Shared viewport config for scroll-triggered reveals. */
27+
export const inView = { once: true, margin: '0px 0px -80px 0px' } as const;
228

329
export const fadeUp: Variants = {
4-
hidden: { opacity: 0, y: 20 },
30+
hidden: { opacity: 0, y: 24 },
531
visible: {
632
opacity: 1,
733
y: 0,
8-
transition: { duration: 0.4, ease: [0.22, 1, 0.36, 1] },
34+
transition: { duration: duration.slow, ease: ease.out },
935
},
1036
exit: {
1137
opacity: 0,
12-
y: -12,
13-
transition: { duration: 0.25, ease: [0.4, 0, 1, 1] },
38+
y: -8,
39+
transition: { duration: duration.fast, ease: ease.in },
1440
},
1541
};
1642

1743
export const fadeIn: Variants = {
1844
hidden: { opacity: 0 },
1945
visible: {
2046
opacity: 1,
21-
transition: { duration: 0.3, ease: 'easeOut' },
47+
transition: { duration: duration.slow, ease: ease.out },
2248
},
2349
exit: {
2450
opacity: 0,
25-
transition: { duration: 0.2, ease: 'easeIn' },
51+
transition: { duration: duration.fast, ease: ease.in },
2652
},
2753
};
2854

2955
export const staggerContainer: Variants = {
3056
hidden: {},
3157
visible: {
3258
transition: {
33-
staggerChildren: 0.04,
34-
delayChildren: 0.05,
59+
staggerChildren: 0.06,
60+
delayChildren: 0.04,
3561
},
3662
},
3763
};
3864

65+
export const staggerSlow: Variants = {
66+
hidden: {},
67+
visible: {
68+
transition: {
69+
staggerChildren: 0.1,
70+
delayChildren: 0.1,
71+
},
72+
},
73+
};
74+
75+
/** Editorial text reveal — the child slides up from behind an overflow-hidden mask. */
76+
export const maskReveal: Variants = {
77+
hidden: { y: '110%' },
78+
visible: {
79+
y: '0%',
80+
transition: { duration: duration.crawl, ease: ease.out },
81+
},
82+
};
83+
84+
/** Image reveal — a clip-path wipe paired with a slow settle from a slight zoom. */
85+
export const imageReveal: Variants = {
86+
hidden: { clipPath: 'inset(100% 0% 0% 0%)', scale: 1.12 },
87+
visible: {
88+
clipPath: 'inset(0% 0% 0% 0%)',
89+
scale: 1,
90+
transition: {
91+
clipPath: { duration: 1.1, ease: ease.inOut },
92+
scale: { duration: 1.6, ease: ease.out },
93+
},
94+
},
95+
};
96+
97+
/** Horizontal rule that draws in from the left. */
98+
export const lineGrow: Variants = {
99+
hidden: { scaleX: 0 },
100+
visible: {
101+
scaleX: 1,
102+
transition: { duration: duration.crawl, ease: ease.inOut },
103+
},
104+
};
105+
39106
export const scaleIn: Variants = {
40-
hidden: { opacity: 0, scale: 0.94 },
107+
hidden: { opacity: 0, scale: 0.96 },
41108
visible: {
42109
opacity: 1,
43110
scale: 1,
44-
transition: { type: 'spring', stiffness: 300, damping: 28 },
111+
transition: spring.gentle,
45112
},
46113
exit: {
47114
opacity: 0,
48-
scale: 0.94,
49-
transition: { duration: 0.18, ease: 'easeIn' },
115+
scale: 0.96,
116+
transition: { duration: duration.fast, ease: ease.in },
50117
},
51118
};
52119

@@ -55,12 +122,12 @@ export const slideInLeft: Variants = {
55122
visible: {
56123
opacity: 1,
57124
x: 0,
58-
transition: { duration: 0.35, ease: [0.22, 1, 0.36, 1] },
125+
transition: { duration: duration.base, ease: ease.out },
59126
},
60127
exit: {
61128
opacity: 0,
62129
x: -16,
63-
transition: { duration: 0.2, ease: 'easeIn' },
130+
transition: { duration: duration.fast, ease: ease.in },
64131
},
65132
};
66133

@@ -69,27 +136,25 @@ export const slideInRight: Variants = {
69136
visible: {
70137
opacity: 1,
71138
x: 0,
72-
transition: { duration: 0.35, ease: [0.22, 1, 0.36, 1] },
139+
transition: { duration: duration.base, ease: ease.out },
73140
},
74141
exit: {
75142
opacity: 0,
76143
x: 16,
77-
transition: { duration: 0.2, ease: 'easeIn' },
144+
transition: { duration: duration.fast, ease: ease.in },
78145
},
79146
};
80147

81148
export const listItem: Variants = {
82-
hidden: { opacity: 0, x: -16 },
149+
hidden: { opacity: 0, y: 12 },
83150
visible: {
84151
opacity: 1,
85-
x: 0,
86-
transition: { duration: 0.3, ease: [0.22, 1, 0.36, 1] },
152+
y: 0,
153+
transition: { duration: duration.base, ease: ease.out },
87154
},
88155
exit: {
89156
opacity: 0,
90-
x: 16,
91-
height: 0,
92-
marginBottom: 0,
93-
transition: { duration: 0.22, ease: 'easeIn' },
157+
x: 24,
158+
transition: { duration: duration.fast, ease: ease.in },
94159
},
95160
};
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import type { ReactNode } from 'react';
2+
import { motion } from 'framer-motion';
3+
import { duration, ease, fadeUp, imageReveal, staggerSlow } from '../../animations/variants';
4+
5+
const AUTH_IMAGE =
6+
'https://images.unsplash.com/photo-1495474472287-4d71bcdd2085?w=1200&auto=format&q=80';
7+
8+
interface AuthLayoutProps {
9+
title: string;
10+
subtitle: string;
11+
children: ReactNode;
12+
}
13+
14+
export function AuthLayout({ title, subtitle, children }: AuthLayoutProps) {
15+
return (
16+
<div className="container-page grid min-h-[calc(100vh-4rem)] items-center gap-12 py-12 lg:grid-cols-2 lg:gap-20">
17+
{/* Editorial image panel — desktop only */}
18+
<div
19+
className="relative hidden h-full max-h-[44rem] min-h-[34rem] overflow-hidden rounded-[2rem] bg-espresso-950 lg:block"
20+
aria-hidden="true"
21+
>
22+
<motion.img
23+
src={AUTH_IMAGE}
24+
alt=""
25+
variants={imageReveal}
26+
initial="hidden"
27+
animate="visible"
28+
className="absolute inset-0 h-full w-full object-cover"
29+
/>
30+
<div className="absolute inset-0 bg-gradient-to-t from-espresso-950/90 via-espresso-950/20 to-transparent" />
31+
<motion.div
32+
className="absolute inset-x-10 bottom-10 text-white"
33+
initial={{ opacity: 0, y: 24 }}
34+
animate={{ opacity: 1, y: 0 }}
35+
transition={{ delay: 0.8, duration: duration.slow, ease: ease.out }}
36+
>
37+
<p className="font-serif text-3xl italic leading-snug">
38+
Roasted in small batches, every week, in Stockholm.
39+
</p>
40+
<p className="mt-4 text-xs uppercase tracking-[0.25em] text-espresso-300">
41+
Rostid · Stockholm
42+
</p>
43+
</motion.div>
44+
</div>
45+
46+
<motion.div
47+
className="mx-auto w-full max-w-md"
48+
variants={staggerSlow}
49+
initial="hidden"
50+
animate="visible"
51+
>
52+
<motion.div variants={fadeUp} className="mb-8">
53+
<p className="text-xs font-medium uppercase tracking-[0.25em] text-espresso-600">
54+
Rostid
55+
</p>
56+
<h1 className="mt-3 font-serif text-4xl font-semibold tracking-tight text-stone-900">
57+
{title}
58+
</h1>
59+
<p className="mt-2 text-stone-500">{subtitle}</p>
60+
</motion.div>
61+
62+
<motion.div variants={fadeUp}>{children}</motion.div>
63+
</motion.div>
64+
</div>
65+
);
66+
}

‎client/src/components/layout/Layout.tsx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { AnimatePresence, motion } from 'framer-motion';
44
import { Navbar } from './Navbar';
55
import { Footer } from './Footer';
66
import { CookieBanner } from '../ui/CookieBanner';
7+
import { duration, ease } from '../../animations/variants';
78

89
export default function Layout() {
910
const location = useLocation();
@@ -28,10 +29,9 @@ export default function Layout() {
2829
<AnimatePresence mode="wait" initial={false}>
2930
<motion.div
3031
key={location.pathname}
31-
initial={{ opacity: 0, y: 8 }}
32-
animate={{ opacity: 1, y: 0 }}
33-
exit={{ opacity: 0, y: -4 }}
34-
transition={{ duration: 0.25, ease: [0.22, 1, 0.36, 1] }}
32+
initial={{ opacity: 0, y: 12 }}
33+
animate={{ opacity: 1, y: 0, transition: { duration: duration.slow, ease: ease.out } }}
34+
exit={{ opacity: 0, transition: { duration: duration.fast, ease: ease.in } }}
3535
>
3636
<Outlet />
3737
</motion.div>

0 commit comments

Comments
 (0)