Skip to content

Commit 800b734

Browse files
committed
feat: fetch spent time
1 parent 1fa2f50 commit 800b734

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/components/PoemList/PoemItem/index.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@ import './style.scss'
22

33
type PoemItemProps = {
44
username: string
5+
time: number
56
word: string
67
poem: string[]
78
}
89

910
const PoemItem: React.FC<PoemItemProps> = (props) => {
10-
const { username, word, poem } = props
11+
const { username, time, word, poem } = props
1112

1213
return (
1314
<div className="poem-item" data-component="">
14-
<div className="username">{username}</div>
15+
<div className="username">
16+
{username} {time}
17+
</div>
1518
{word.split('').map((letter, index) => {
1619
return (
1720
<div key={index} className="poem">

src/components/PoemList/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ type PoemListProps = unknown
1010
type PoemType = {
1111
id: number
1212
username: string
13+
time: number
1314
word: string
1415
poem: string[]
1516
}
@@ -22,6 +23,7 @@ const fetchPoemList = async (): Promise<PoemType[]> => {
2223
type OriginPoemType = {
2324
id: number
2425
content: string
26+
timeSpent: number
2527
word: {
2628
text: string
2729
}
@@ -34,6 +36,7 @@ const fetchPoemList = async (): Promise<PoemType[]> => {
3436
{
3537
poems {
3638
id
39+
timeSpent
3740
content
3841
word {
3942
text
@@ -46,6 +49,7 @@ const fetchPoemList = async (): Promise<PoemType[]> => {
4649
const poemList: PoemType[] = poems.map((poem: OriginPoemType) => ({
4750
id: poem.id,
4851
username: '김정빈지노',
52+
time: poem.timeSpent,
4953
word: poem.word.text,
5054
poem: poem.content.split('@'),
5155
}))

0 commit comments

Comments
 (0)