-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.tsx
45 lines (42 loc) · 1.08 KB
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import React from 'react'
import { List, Typography, Space, Card, Button, Divider } from 'antd'
import { CheckCircleTwoTone } from '@ant-design/icons'
type Todo = {
id: number
contents: string
finished: boolean
}
type Props = {
isLoading?: boolean
todos?: Todo[]
getContent?: () => void
}
export const Todos: React.VFC<Props> = ({ todos, isLoading, getContent }) => {
console.log(isLoading, new Date())
return (
<Card title="TODO List" style={{ margin: '5%' }}>
{getContent && (
<>
<Button onClick={getContent}>データを取る</Button>
<Divider />
</>
)}
<List
loading={isLoading}
dataSource={todos}
renderItem={({ id, contents, finished }) => (
<List.Item key={id}>
<Typography.Title level={3}>
<Space>
<CheckCircleTwoTone
twoToneColor={finished ? '#52c41a' : '#e3e3e3'}
/>
{contents}
</Space>
</Typography.Title>
</List.Item>
)}
/>
</Card>
)
}