@@ -74,12 +74,12 @@ export function ContestMainBanner() {
74
74
}
75
75
} )
76
76
77
- // useEffect(() => {
78
- // const timer = setTimeout(() => {
79
- // setFacade((facade + 1) % slides.length)
80
- // }, 5000)
81
- // return () => clearTimeout(timer)
82
- // }, [facade])
77
+ useEffect ( ( ) => {
78
+ const timer = setTimeout ( ( ) => {
79
+ setFacade ( ( facade + 1 ) % slides . length )
80
+ } , 5000 )
81
+ return ( ) => clearTimeout ( timer )
82
+ } , [ facade ] )
83
83
84
84
const handleClick = ( next : number ) => {
85
85
setFacade ( next % slides . length )
@@ -172,33 +172,26 @@ export function ContestMainBanner() {
172
172
) }
173
173
/>
174
174
</ div >
175
- < div
176
- className = "bg-primary absolute -left-[10%] top-[20%] -z-10 h-[160px] w-[300px] rounded-full"
177
- style = { {
178
- transform : 'rotate(-35deg)' ,
179
- backgroundColor : OvalIconColors [ slide . type ] . leftup
180
- } }
175
+
176
+ < OvalIcon
177
+ position = "-left-[10%] top-[20%] h-[160px] w-[300px]"
178
+ transform = "rotate(-35deg)"
179
+ backgroundColor = { OvalIconColors [ slide . type ] . leftup }
181
180
/>
182
- < div
183
- className = "absolute -bottom-7 -left-[10%] -z-10 h-[100px] w-[315px] rounded-full bg-[#D2E4FF]"
184
- style = { {
185
- transform : 'rotate(-35deg)' ,
186
- backgroundColor : OvalIconColors [ slide . type ] . leftdown
187
- } }
181
+ < OvalIcon
182
+ position = "-bottom-7 -left-[10%] h-[100px] w-[315px]"
183
+ transform = "rotate(-35deg)"
184
+ backgroundColor = { OvalIconColors [ slide . type ] . leftdown }
188
185
/>
189
- < div
190
- className = "absolute right-[2%] top-0 -z-10 h-[225px] w-[750px] rounded-full bg-[#7DAFFF]"
191
- style = { {
192
- transform : 'rotate(-30deg)' ,
193
- backgroundColor : OvalIconColors [ slide . type ] . rightup
194
- } }
186
+ < OvalIcon
187
+ position = "right-[2%] top-0 h-[225px] w-[750px]"
188
+ transform = "rotate(-30deg)"
189
+ backgroundColor = { OvalIconColors [ slide . type ] . rightup }
195
190
/>
196
- < div
197
- className = "absolute -bottom-10 -right-[35%] -z-10 h-[290px] w-[1200px] rounded-full bg-[#0151D3]"
198
- style = { {
199
- transform : 'rotate(-30deg)' ,
200
- backgroundColor : OvalIconColors [ slide . type ] . rightdown
201
- } }
191
+ < OvalIcon
192
+ position = "-bottom-10 -right-[35%] h-[290px] w-[1200px]"
193
+ transform = "rotate(-30deg)"
194
+ backgroundColor = { OvalIconColors [ slide . type ] . rightdown }
202
195
/>
203
196
</ div >
204
197
) ) }
@@ -207,3 +200,25 @@ export function ContestMainBanner() {
207
200
</ div >
208
201
)
209
202
}
203
+
204
+ function OvalIcon ( {
205
+ position,
206
+ transform,
207
+ backgroundColor,
208
+ additionalClasses
209
+ } : {
210
+ position : string
211
+ transform : string
212
+ backgroundColor : string
213
+ additionalClasses ?: string
214
+ } ) {
215
+ return (
216
+ < div
217
+ className = { cn ( 'absolute -z-10 rounded-full' , position , additionalClasses ) }
218
+ style = { {
219
+ transform,
220
+ backgroundColor
221
+ } }
222
+ />
223
+ )
224
+ }
0 commit comments