-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1558 from 42organization/agenda
[test-deploy] ui bug fix 및 기타 등등
- Loading branch information
Showing
39 changed files
with
382 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,60 @@ | ||
import React from 'react'; | ||
import { AgendaStatus } from 'constants/agenda/agenda'; | ||
import styles from 'styles/agenda/Home/AgendaDeadLine.module.scss'; | ||
|
||
interface deadLineProps { | ||
deadLine: string | Date; | ||
status: AgendaStatus; | ||
start?: string | Date; | ||
end?: string | Date; | ||
} | ||
|
||
const AgendaDeadLine = ({ deadLine }: deadLineProps) => { | ||
const AgendaDeadLine = ({ deadLine, status, start, end }: deadLineProps) => { | ||
const currentDate = new Date(); | ||
const deadLineDate = new Date(deadLine); | ||
const startDate = new Date(start || ''); | ||
const endDate = new Date(end || ''); | ||
|
||
const timeDiff = deadLineDate.getTime() - currentDate.getTime(); | ||
let daysLeft; | ||
let daysLeft: number | string = 'DAY'; | ||
|
||
if (timeDiff == 0) daysLeft = 'Day'; | ||
else if (timeDiff > 0) daysLeft = Math.ceil(timeDiff / (1000 * 60 * 60 * 24)); | ||
if (timeDiff > 0) daysLeft = Math.ceil(timeDiff / (1000 * 60 * 60 * 24)); | ||
|
||
if (timeDiff >= 0) { | ||
return ( | ||
<div className={styles.agendaItemDeadLineBox}> | ||
<div className={styles.agendaDeadLineText}>모집마감</div> | ||
<div className={styles.agendaDeadLine}>D-{daysLeft}</div> | ||
</div> | ||
); | ||
} | ||
// 컨펌인 상태 구분 | ||
let curr; | ||
if (!start || !end) curr = 'error'; | ||
else if (currentDate >= startDate && currentDate <= endDate) curr = '진행중'; | ||
else if (currentDate < startDate) curr = '진행예정'; | ||
else curr = '진행완료'; | ||
|
||
return null; | ||
switch (status) { | ||
case 'FINISH': | ||
return ( | ||
<div className={`${styles.agendaItemDeadLineBox} ${styles.finished}`}> | ||
<div className={styles.agendaDeadLineText}>종료</div> | ||
</div> | ||
); | ||
case 'CONFIRM': | ||
return ( | ||
<div className={`${styles.agendaItemDeadLineBox} ${styles.confirm}`}> | ||
<div className={styles.agendaDeadLineText}>{curr}</div> | ||
</div> | ||
); | ||
case 'CANCEL': | ||
return ( | ||
<div className={`${styles.agendaItemDeadLineBox} ${styles.cancel}`}> | ||
<div className={styles.agendaDeadLineText}>취소</div> | ||
</div> | ||
); | ||
default: | ||
if (timeDiff >= 0) { | ||
return ( | ||
<div className={styles.agendaItemDeadLineBox}> | ||
<div className={styles.agendaDeadLineText}>모집마감</div> | ||
<div className={styles.agendaDeadLine}>D-{daysLeft}</div> | ||
</div> | ||
); | ||
} else return null; | ||
} | ||
}; | ||
|
||
export default AgendaDeadLine; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.