Skip to content

Commit 805de33

Browse files
committed
fix(fe): change oval icon using function
1 parent 974ba12 commit 805de33

File tree

1 file changed

+45
-30
lines changed

1 file changed

+45
-30
lines changed

apps/frontend/app/(client)/(main)/contest/_components/ContestMainBanner.tsx

Lines changed: 45 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ export function ContestMainBanner() {
7474
}
7575
})
7676

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])
8383

8484
const handleClick = (next: number) => {
8585
setFacade(next % slides.length)
@@ -172,33 +172,26 @@ export function ContestMainBanner() {
172172
)}
173173
/>
174174
</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}
181180
/>
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}
188185
/>
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}
195190
/>
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}
202195
/>
203196
</div>
204197
))}
@@ -207,3 +200,25 @@ export function ContestMainBanner() {
207200
</div>
208201
)
209202
}
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

Comments
 (0)