MethodologySection.tsx
2.27 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
import type { Methodology, MethodologyStep } from '../types/home';
export interface MethodologySectionProps {
methodology: Methodology;
currentStep: number;
onStepChange: (index: number) => void;
}
export function MethodologySection({
methodology,
currentStep,
onStepChange,
}: MethodologySectionProps) {
if (!methodology.display_status || methodology.steps.length === 0) {
return null;
}
const currentStepData: MethodologyStep | undefined = methodology.steps[currentStep];
if (!currentStepData) {
return null;
}
return (
<section className="py-24 relative overflow-hidden bg-surface-container-lowest" data-testid="methodology-section">
<div className="max-w-container-max mx-auto px-margin-mobile tablet:px-margin-desktop relative z-10">
<div className="mb-16">
<h2 className="text-headline-md mb-2">{methodology.main_title}</h2>
<p className="text-body-md text-on-surface-variant">{methodology.sub_title}</p>
</div>
<div className="grid grid-cols-1 tablet:grid-cols-2 lg:grid-cols-4 gap-8">
{methodology.steps.map((step, index) => (
<div
key={index}
onClick={() => onStepChange(index)}
data-testid={`step-${index}`}
className={`flex flex-col bg-white rounded-3xl border shadow-sm hover:shadow-xl hover:-translate-y-2 transition-all duration-300 overflow-hidden cursor-pointer ${
index === currentStep
? 'border-primary/40'
: 'border-outline-variant/30'
}`}
>
<div className="w-full h-48 bg-primary/5 flex items-center justify-center overflow-hidden">
<img
src={step.step_image}
alt={step.step_name}
className="w-full h-full object-cover"
/>
</div>
<div className="p-8 pt-6">
<h4 className="text-headline-sm text-[20px] font-bold text-primary mb-3">{step.step_name}</h4>
<p className="text-body-md text-on-surface-variant text-sm leading-relaxed">
{step.step_description}
</p>
</div>
</div>
))}
</div>
</div>
</section>
);
}