-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathOverlayCaseFunnel.tsx
33 lines (30 loc) · 1.05 KB
/
OverlayCaseFunnel.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
'use client';
import { useFunnel } from '@use-funnel/next-app-router';
import { SchoolInput } from './SchoolInput';
import { StartDate } from './StartDate';
export const OverlayFunnel = () => {
const funnel = useFunnel<{
SelectSchool: { school?: string };
StartDate: { school: string; startDate?: string };
Confirm: { school: string; startDate: string };
}>({ id: 'general', initial: { context: {}, step: 'SelectSchool' } });
return (
<funnel.Render
SelectSchool={({ history }) => <SchoolInput onNext={(school) => history.push('StartDate', { school: school })} />}
StartDate={funnel.Render.overlay({
render: ({ history, context }) => (
<StartDate
startDate={context.startDate}
onNext={(startDate) => history.push('Confirm', { school: context.school, startDate: startDate })}
/>
),
})}
Confirm={({ context }) => (
<div>
<div>school: {context.school}</div>
<div>startDate: {context.startDate}</div>
</div>
)}
/>
);
};