Skip to content

Commit ceda54b

Browse files
committed
fix: resolved CLS issue at the main page RecruitmentStatus
1 parent c3c60d6 commit ceda54b

File tree

2 files changed

+31
-30
lines changed

2 files changed

+31
-30
lines changed

src/components/organisms/home/RecruitmentStatusSection/index.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
11
'use client';
22

3-
import dynamic from 'next/dynamic';
4-
53
import { sendGAEvent } from '@next/third-parties/google';
64

75
import Button from '@/components/molecules/Button';
6+
import RecruitmentSummary from '@/components/organisms/home/RecruitmentSummary';
87
import useCopy from '@/hook/useCopyToClipboard';
98
import { displayApplication, getCurrentStatus } from '@/libs/utils/recruit';
109

1110
import styles from './index.module.scss';
1211

13-
const RecruitmentSummary = dynamic(
14-
() => import('@/components/organisms/home/RecruitmentSummary'),
15-
{ ssr: false },
16-
);
17-
1812
function RecruitmentStatusSection() {
1913
const now = Date.now();
2014
const currentStatus = getCurrentStatus(now);

src/components/organisms/home/RecruitmentSummary/index.tsx

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,41 @@ type Props = {
1010
};
1111

1212
function RecruitmentSummary({ currentStatus }: Props) {
13-
const isRecruiting = currentStatus !== 'after';
1413
const currentApplicationDetail = displayApplication[currentStatus];
15-
1614
const { dates, hours, minutes, seconds } = useTimer(
1715
currentApplicationDetail?.dueDate,
18-
isRecruiting ? 1000 : null,
16+
1000,
1917
);
2018

21-
return (
22-
<>
23-
{currentStatus === 'after' ? (
24-
<SummaryCard />
25-
) : (
26-
<div className={styles.timerWrapper}>
27-
<div className={styles.timerDescription}>
28-
{currentStatus === 'before' ? '모집 시작까지' : '모집 마감까지'}
29-
</div>
30-
<Timer
31-
dates={dates}
32-
hours={hours}
33-
minutes={minutes}
34-
seconds={seconds}
35-
isRecruiting={isRecruiting}
36-
/>
37-
</div>
38-
)}
39-
</>
40-
);
19+
const elements = {
20+
before: () => (
21+
<div className={styles.timerWrapper}>
22+
<div className={styles.timerDescription}>모집 시작까지</div>
23+
<Timer
24+
dates={dates}
25+
hours={hours}
26+
minutes={minutes}
27+
seconds={seconds}
28+
isRecruiting={true}
29+
/>
30+
</div>
31+
),
32+
ongoing: () => (
33+
<div className={styles.timerWrapper}>
34+
<div className={styles.timerDescription}>모집 마감까지</div>
35+
<Timer
36+
dates={dates}
37+
hours={hours}
38+
minutes={minutes}
39+
seconds={seconds}
40+
isRecruiting={true}
41+
/>
42+
</div>
43+
),
44+
after: () => <SummaryCard />,
45+
};
46+
47+
return elements[currentStatus]();
4148
}
4249

4350
export default RecruitmentSummary;

0 commit comments

Comments
 (0)