-
Notifications
You must be signed in to change notification settings - Fork 0
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 #23 from payw-org/feat/19-main-todo
Feat/19 main todo
- Loading branch information
Showing
32 changed files
with
605 additions
and
185 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
2 changes: 1 addition & 1 deletion
2
src/components/Timer/DisplayTime/index.tsx → ...s/MainSection/Timer/DisplayTime/index.tsx
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
38 changes: 22 additions & 16 deletions
38
src/components/Timer/index.tsx → src/components/MainSection/Timer/index.tsx
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@use '@/style/package' as *; | ||
|
||
.timer[data-component] { | ||
@include bg-overlay(6rem); | ||
width: max-content; | ||
display: flex; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import React, { useRef, useState } from 'react' | ||
import { useStore } from '@/store' | ||
import { getFormattedDate } from '@/utils/time' | ||
import { setElementAtCursor } from '@/utils/events' | ||
import { Timer } from './Timer' | ||
import './style.scss' | ||
|
||
export const MainSection: React.FC = () => { | ||
const { | ||
store: { mainTodo }, | ||
} = useStore() | ||
const [isShowDate, setIsShowDate] = useState<boolean>(false) | ||
const dateElement = useRef<HTMLDivElement>(null) | ||
|
||
const showDate = (e) => { | ||
if (!isShowDate) setIsShowDate(true) | ||
|
||
setTimeout(() => { | ||
if (!dateElement.current) return | ||
|
||
setElementAtCursor(dateElement.current, e) | ||
}, 0) | ||
} | ||
|
||
return ( | ||
<div className="main-section" data-component=""> | ||
<div className="title-wrapper"> | ||
<span | ||
className="title" | ||
onPointerMove={showDate} | ||
onPointerOut={() => setIsShowDate(false)} | ||
> | ||
{mainTodo.title} | ||
<div | ||
className={'date ' + (isShowDate ? 'show' : 'hide')} | ||
ref={dateElement} | ||
> | ||
{getFormattedDate(mainTodo.dueDate, 'YYYY년 M월 D일 hh:mm:ss')} | ||
</div> | ||
</span> | ||
<span className="suffix"> | ||
{mainTodo.dueDate > new Date() ? '남은시간' : '지난시간'} | ||
</span> | ||
</div> | ||
<Timer mainDate={mainTodo.dueDate}></Timer> | ||
</div> | ||
) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
@use '@/style/package' as *; | ||
|
||
.main-section[data-component] { | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
|
||
> .title-wrapper { | ||
@include bg-overlay(7.3rem); | ||
width: fit-content; | ||
margin: 0 auto; | ||
margin-bottom: 2rem; | ||
text-shadow: 0 1px 2px rgba($color-black, 33%); | ||
|
||
.title { | ||
position: relative; | ||
font: { | ||
size: 6rem; | ||
weight: 500; | ||
} | ||
letter-spacing: -0.01em; | ||
color: $color-gray-50; | ||
|
||
.date { | ||
transition: opacity 0.2s 0.1s; | ||
position: absolute; | ||
width: max-content; | ||
font: { | ||
size: 1.4rem; | ||
weight: 500; | ||
} | ||
color: $color-gray-700; | ||
background-color: $color-gray-50; | ||
padding: 0.5rem 0.9rem; | ||
border-radius: 0.4rem; | ||
box-shadow: 0 0.4rem 0.8rem rgba($color-black, 50%); | ||
text-shadow: none; | ||
pointer-events: none; | ||
|
||
&.show { | ||
opacity: 1; | ||
} | ||
|
||
&.hide { | ||
opacity: 0; | ||
} | ||
} | ||
} | ||
|
||
.suffix { | ||
font: { | ||
size: 3.2rem; | ||
weight: 500; | ||
} | ||
letter-spacing: -0.02em; | ||
color: $color-gray-50; | ||
margin-left: 1.2rem; | ||
} | ||
} | ||
} |
Oops, something went wrong.