Skip to content

Commit

Permalink
[#22] feat : DisplayTime이 0이면 보이지 않도록 함
Browse files Browse the repository at this point in the history
  • Loading branch information
choibumsu committed Feb 22, 2021
1 parent ba34456 commit 96be8c0
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 21 deletions.
56 changes: 36 additions & 20 deletions src/components/MainSection/Timer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,42 @@ export const Timer: React.FC<TimerProps> = ({ mainDate }) => {

return (
<div className="timer" data-component="">
<DisplayTime
currentTime={restDay}
nextTime={nextRestDay}
unit="일"
></DisplayTime>
<DisplayTime
currentTime={hour}
nextTime={nextHour}
unit="시간"
></DisplayTime>
<DisplayTime
currentTime={minute}
nextTime={nextMinute}
unit="분"
></DisplayTime>
<DisplayTime
currentTime={second}
nextTime={nextSecond}
unit="초"
></DisplayTime>
{+restDay === 0 ? (
<></>
) : (
<DisplayTime
currentTime={restDay}
nextTime={nextRestDay}
unit="일"
></DisplayTime>
)}
{+hour === 0 && +restDay === 0 ? (
<></>
) : (
<DisplayTime
currentTime={hour}
nextTime={nextHour}
unit="시간"
></DisplayTime>
)}
{+hour === 0 && +restDay === 0 && +minute === 0 ? (
<></>
) : (
<DisplayTime
currentTime={minute}
nextTime={nextMinute}
unit="분"
></DisplayTime>
)}
{+hour === 0 && +restDay === 0 && +minute === 0 && +second === 0 ? (
<></>
) : (
<DisplayTime
currentTime={second}
nextTime={nextSecond}
unit="초"
></DisplayTime>
)}
</div>
)
}
2 changes: 1 addition & 1 deletion src/components/MainSection/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const MainSection: React.FC = () => {
className={'date ' + (isShowDate ? 'show' : 'hide')}
ref={dateElement}
>
{getFormattedDate(mainTodo.dueDate, 'YYYY년 M월 D일 hh:mm:ss')}
{getFormattedDate(mainTodo.dueDate, 'YYYY년 M월 D일 hh:mm')}
</div>
</span>
<span className="suffix">
Expand Down

0 comments on commit 96be8c0

Please sign in to comment.