-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathStepUseCases.tsx
More file actions
64 lines (58 loc) · 1.83 KB
/
Copy pathStepUseCases.tsx
File metadata and controls
64 lines (58 loc) · 1.83 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
"use client";
import type { UseCase, WizardState } from "../../types/wizard";
const USE_CASES: { id: UseCase; label: string; description: string }[] = [
{
id: "b2c",
label: "B2C",
description: "Store for individual customers",
},
{
id: "b2b",
label: "B2B",
description: "Platform for business customers",
},
];
interface Props {
state: WizardState;
onChange: (state: Partial<WizardState>) => void;
}
export function StepUseCases({ state, onChange }: Props) {
function toggle(id: UseCase) {
const current = state.useCases;
const next = current.includes(id)
? current.filter((u) => u !== id)
: [...current, id];
onChange({ useCases: next });
}
return (
<div className="flex flex-col items-center gap-8">
<div className="text-center">
<h2 className="text-2xl font-bold">What kind of store do you want to build?</h2>
<p className="mt-2 text-gray-500 dark:text-gray-400">
You can choose both
</p>
</div>
<div className="flex gap-6">
{USE_CASES.map(({ id, label, description }) => {
const selected = state.useCases.includes(id);
return (
<button
key={id}
onClick={() => toggle(id)}
className={`w-48 rounded-xl border-2 p-8 text-center transition-all cursor-pointer
${selected
? "border-blue-500 bg-blue-50 dark:bg-blue-950"
: "border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"
}`}
>
<div className="text-3xl font-bold">{label}</div>
<div className="mt-2 text-sm text-gray-500 dark:text-gray-400">
{description}
</div>
</button>
);
})}
</div>
</div>
);
}