1
1
import type { ReactNode } from "react"
2
- import { Box , Center , Flex , Heading , Wrap , WrapItem } from "@chakra-ui/react"
2
+
3
+ import { type ImageProps , TwImage } from "@/components/Image"
4
+
5
+ import { cn } from "@/lib/utils/cn"
6
+ import { type MatomoEventOptions } from "@/lib/utils/matomo"
3
7
4
8
import {
5
9
Button ,
6
10
ButtonLink ,
7
- type ButtonLinkProps ,
8
- type ButtonProps ,
9
- } from "@/components/Buttons"
10
- import { Image , type ImageProps } from "@/components/Image"
11
- import Text from "@/components/OldText"
12
-
13
- import { type MatomoEventOptions , trackCustomEvent } from "@/lib/utils/matomo"
11
+ ButtonLinkProps ,
12
+ ButtonProps ,
13
+ } from "./ui/buttons/Button"
14
+ import { Center , Flex } from "./ui/flex"
14
15
15
16
type ButtonLinkType = Omit < ButtonLinkProps , "content" > & {
16
17
content : ReactNode
@@ -48,113 +49,93 @@ const PageHero = ({
48
49
children,
49
50
className,
50
51
} : PageHeroProps ) => (
51
- < Box py = { 4 } px = { 8 } width = "full ">
52
+ < div className = "w-full px-8 py-4 ">
52
53
< Flex
53
- justifyContent = "space-between"
54
- mt = { 8 }
55
- px = { { base : 0 , lg : 16 } }
56
- direction = { { base : isReverse ? "column" : "column-reverse" , lg : "row" } }
57
- className = { className }
54
+ className = { cn (
55
+ "mt-8 justify-between px-0 lg:px-16" ,
56
+ isReverse ? "flex-col" : "flex-col-reverse" ,
57
+ "lg:flex-row" ,
58
+ className
59
+ ) }
58
60
>
59
- < Box
60
- maxW = { { base : "full" , lg : "container.sm" } }
61
- pt = { { base : isReverse ? 0 : 8 , lg : 32 } }
62
- pb = { { base : isReverse ? 8 : 0 , lg : 32 } }
63
- ps = { { base : 0 , lg : 8 } }
64
- me = { { base : 0 , lg : 4 } }
61
+ < div
62
+ // TODO: container.sm width unavailable
63
+ className = { cn (
64
+ "max-w-full lg:max-w-[640px]" ,
65
+
66
+ isReverse ? "pb-8 pt-0" : "pb-0 pt-8" ,
67
+ "lg:py-32" ,
68
+ "ps-0 lg:ps-8" ,
69
+ "me-0 lg:me-4"
70
+ ) }
65
71
>
66
- < Heading
67
- as = "h1"
68
- textTransform = "uppercase"
69
- fontSize = "md"
70
- fontWeight = "normal"
71
- mt = { { base : 0 , lg : 8 } }
72
- mb = { 4 }
73
- color = "text300"
74
- lineHeight = { 1.4 }
75
- >
72
+ < h1 className = "mb-4 mt-0 text-md font-normal uppercase !leading-[1.4] text-text-300 lg:mt-8" >
76
73
{ title }
77
- </ Heading >
78
- < Heading
79
- as = "h2"
80
- fontWeight = "bold"
81
- fontSize = { { base : "2.5rem" , lg : "5xl" } }
82
- maxW = "full"
83
- mb = { 0 }
84
- mt = { { base : 8 , lg : 12 } }
85
- color = "text00"
86
- lineHeight = { 1.4 }
87
- >
74
+ </ h1 >
75
+
76
+ < h2 className = "mb-0 mt-8 max-w-full text-[2.5rem] font-bold !leading-[1.4] lg:mt-12 lg:text-5xl" >
88
77
{ header }
89
- </ Heading >
90
- < Text
91
- fontSize = { { base : "xl" , lg : "2xl" } }
92
- lineHeight = { 1.4 }
93
- color = "text200"
94
- mt = { 4 }
95
- mb = { 8 }
96
- >
78
+ </ h2 >
79
+ < p className = "mb-8 mt-4 text-xl !leading-[1.4] text-text-200 lg:text-2xl" >
97
80
{ subtitle }
98
- </ Text >
81
+ </ p >
82
+
99
83
{ buttons && (
100
- < Wrap spacing = { 2 } overflow = " visible" sx = { { ul : { m : 0 } } } >
84
+ < Flex className = "gap-2 overflow- visible [&_ul]:m-0" >
101
85
{ buttons . map ( ( button , idx ) => {
102
86
const isSecondary = idx !== 0
103
87
if ( isButtonLink ( button ) ) {
104
88
return (
105
- < WrapItem key = { idx } >
89
+ < div key = { idx } >
106
90
< ButtonLink
107
91
variant = { button . variant }
108
92
href = { button . href }
109
- onClick = { ( ) =>
110
- trackCustomEvent ( {
111
- eventCategory : button . matomo . eventCategory ,
112
- eventAction : button . matomo . eventAction ,
113
- eventName : button . matomo . eventName ,
114
- } )
115
- }
93
+ customEventOptions = { {
94
+ eventCategory : button . matomo . eventCategory ,
95
+ eventAction : button . matomo . eventAction ,
96
+ eventName : button . matomo . eventName ,
97
+ } }
116
98
isSecondary = { isSecondary }
117
99
>
118
100
{ button . content }
119
101
</ ButtonLink >
120
- </ WrapItem >
102
+ </ div >
121
103
)
122
104
}
123
105
124
106
if ( button . toId ) {
125
107
return (
126
- < WrapItem key = { idx } >
108
+ < div key = { idx } >
127
109
< Button
128
110
variant = { button . variant }
129
111
toId = { button . toId }
130
- onClick = { ( ) =>
131
- trackCustomEvent ( {
132
- eventCategory : button . matomo . eventCategory ,
133
- eventAction : button . matomo . eventAction ,
134
- eventName : button . matomo . eventName ,
135
- } )
136
- }
112
+ customEventOptions = { {
113
+ eventCategory : button . matomo . eventCategory ,
114
+ eventAction : button . matomo . eventAction ,
115
+ eventName : button . matomo . eventName ,
116
+ } }
137
117
isSecondary = { isSecondary }
138
118
>
139
119
{ button . content }
140
120
</ Button >
141
- </ WrapItem >
121
+ </ div >
142
122
)
143
123
}
144
124
} ) }
145
- </ Wrap >
125
+ </ Flex >
146
126
) }
147
127
{ children }
148
- </ Box >
128
+ </ div >
149
129
< Center
150
- flex = "1 1 50%"
151
- maxWidth = { { base : "560px" , lg : "624px" } }
152
- mt = { { base : 0 , lg : 12 } }
153
- ms = { { base : 0 , lg : 12 } }
154
- w = "full"
155
- alignSelf = "center"
130
+ className = { cn (
131
+ "flex-[1_1_50%]" ,
132
+ "max-w-[560px] lg:max-w-[624px]" ,
133
+ "mt-0 lg:mt-12" ,
134
+ "ms-0 lg:ms-12" ,
135
+ "w-full self-center"
136
+ ) }
156
137
>
157
- < Image
138
+ < TwImage
158
139
src = { image }
159
140
// TODO: adjust value when the old theme breakpoints are removed (src/theme.ts)
160
141
sizes = "(max-width: 992px) 100vw, 624px"
@@ -168,7 +149,7 @@ const PageHero = ({
168
149
/>
169
150
</ Center >
170
151
</ Flex >
171
- </ Box >
152
+ </ div >
172
153
)
173
154
174
155
export default PageHero
0 commit comments