@@ -10,9 +10,12 @@ interface FeatureMechanicsProps {
1010 title : string ;
1111 hint ?: string ;
1212 items : FeatureMechanicsItem [ ] ;
13- onSelect ?: ( index : number ) => void ;
13+ onSelect ?: ( item : FeatureMechanicsItem ) => void ;
1414}
1515
16+ const CARD_CLASS =
17+ "w-full h-full text-left rounded-3xl p-6 transition-all duration-500 hover:-translate-y-1" ;
18+
1619export function FeatureMechanics ( { title, hint, items, onSelect } : FeatureMechanicsProps ) {
1720 return (
1821 < section className = "max-w-4xl mx-auto px-6 mb-24" >
@@ -23,20 +26,35 @@ export function FeatureMechanics({ title, hint, items, onSelect }: FeatureMechan
2326 < div className = "grid sm:grid-cols-2 lg:grid-cols-3 gap-5" >
2427 { items . map ( ( item , i ) => (
2528 < SectionReveal key = { item . key ?? item . name } delay = { i * 0.06 } >
26- < button
27- type = "button"
28- onClick = { ( ) => onSelect ?.( i ) }
29- className = "w-full h-full text-left rounded-3xl p-6 transition-all duration-500 hover:-translate-y-1 cursor-pointer"
30- style = { {
31- background : "var(--kb-bg-elevated)" ,
32- border : "1px solid var(--kb-glass-border)" ,
33- boxShadow : "var(--kb-shadow-card)" ,
34- } }
35- >
36- < span className = "text-2xl" > { item . icon } </ span >
37- < h3 className = "font-serif text-lg font-semibold text-kb-text mt-3 mb-2" > { item . name } </ h3 >
38- < p className = "text-sm text-kb-text2 leading-relaxed" > { item . desc } </ p >
39- </ button >
29+ { onSelect ? (
30+ < button
31+ type = "button"
32+ onClick = { ( ) => onSelect ( item ) }
33+ className = { `${ CARD_CLASS } cursor-pointer focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-kb-brand` }
34+ style = { {
35+ background : "var(--kb-bg-elevated)" ,
36+ border : "1px solid var(--kb-glass-border)" ,
37+ boxShadow : "var(--kb-shadow-card)" ,
38+ } }
39+ >
40+ < span className = "text-2xl" > { item . icon } </ span >
41+ < span className = "font-serif text-lg font-semibold text-kb-text mt-3 mb-2 block" > { item . name } </ span >
42+ < p className = "text-sm text-kb-text2 leading-relaxed" > { item . desc } </ p >
43+ </ button >
44+ ) : (
45+ < div
46+ className = { CARD_CLASS }
47+ style = { {
48+ background : "var(--kb-bg-elevated)" ,
49+ border : "1px solid var(--kb-glass-border)" ,
50+ boxShadow : "var(--kb-shadow-card)" ,
51+ } }
52+ >
53+ < span className = "text-2xl" > { item . icon } </ span >
54+ < span className = "font-serif text-lg font-semibold text-kb-text mt-3 mb-2 block" > { item . name } </ span >
55+ < p className = "text-sm text-kb-text2 leading-relaxed" > { item . desc } </ p >
56+ </ div >
57+ ) }
4058 </ SectionReveal >
4159 ) ) }
4260 </ div >
0 commit comments