File tree Expand file tree Collapse file tree 2 files changed +31
-30
lines changed
src/components/organisms/home Expand file tree Collapse file tree 2 files changed +31
-30
lines changed Original file line number Diff line number Diff line change 11'use client' ;
22
3- import dynamic from 'next/dynamic' ;
4-
53import { sendGAEvent } from '@next/third-parties/google' ;
64
75import Button from '@/components/molecules/Button' ;
6+ import RecruitmentSummary from '@/components/organisms/home/RecruitmentSummary' ;
87import useCopy from '@/hook/useCopyToClipboard' ;
98import { displayApplication , getCurrentStatus } from '@/libs/utils/recruit' ;
109
1110import styles from './index.module.scss' ;
1211
13- const RecruitmentSummary = dynamic (
14- ( ) => import ( '@/components/organisms/home/RecruitmentSummary' ) ,
15- { ssr : false } ,
16- ) ;
17-
1812function RecruitmentStatusSection ( ) {
1913 const now = Date . now ( ) ;
2014 const currentStatus = getCurrentStatus ( now ) ;
Original file line number Diff line number Diff line change @@ -10,34 +10,41 @@ type Props = {
1010} ;
1111
1212function 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
4350export default RecruitmentSummary ;
You can’t perform that action at this time.
0 commit comments