-
Notifications
You must be signed in to change notification settings - Fork 0
/
table.stories.tsx
197 lines (190 loc) · 5.13 KB
/
table.stories.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
import { ComponentStory, ComponentMeta } from '@storybook/react';
import Icon from '@components/common/Icon';
import Table from '@components/common/Table';
import Text from '@components/common/Text';
export default {
title: 'common/Table',
component: Table,
} as ComponentMeta<typeof Table>;
const noticeList = [
{
id: 1,
title: '스터디 가입전 해당 공지사항을 숙지해주세요.',
writer: '파크',
date: '2022.10.22',
view: 101,
isFixed: true,
isNew: false,
commentCount: 14,
},
{
id: 2,
title: '스터디 전체 공지 드립니다.',
writer: '파크크크크크크크크',
date: '1시간 전',
view: 11,
isFixed: true,
isNew: true,
commentCount: 0,
},
];
export const NoticeList: ComponentStory<typeof Table> = () => (
<Table
caption="공지사항"
columnsWidth={['85px', '*', '120px', '120px', '85px']}
>
<Table.Head>
<Table.Row>
<Table.HeadCell>번호</Table.HeadCell>
<Table.HeadCell>제목</Table.HeadCell>
<Table.HeadCell>작성자</Table.HeadCell>
<Table.HeadCell>날짜</Table.HeadCell>
<Table.HeadCell>조회수</Table.HeadCell>
</Table.Row>
</Table.Head>
<Table.Body>
{noticeList
.reverse()
.map(({ id, title, writer, date, view, commentCount }) => (
<Table.Row key={id}>
<Table.BodyCell>
<Text ellipsis>{id}</Text>
</Table.BodyCell>
<Table.BodyCell
sx={{
justifyContent: 'flex-start',
}}
>
<Text ellipsis>{title}</Text>
{commentCount > 0 && (
<Text.Highlight
as="b"
sx={{ fontWeight: 'bold', color: 'primary' }}
>
{commentCount}
</Text.Highlight>
)}
</Table.BodyCell>
<Table.BodyCell>
<Text ellipsis>{writer}</Text>
</Table.BodyCell>
<Table.BodyCell>
<Text ellipsis>{date}</Text>
</Table.BodyCell>
<Table.BodyCell>
<Text ellipsis>{view}</Text>
</Table.BodyCell>
</Table.Row>
))}
</Table.Body>
</Table>
);
const memberManagementList = [
{
id: 1,
nickName: 'Hemdi',
status: 'waiting',
dateOfSubscription: '2022.10.22',
periodOfActivity: 0,
uncheckin: 0,
uncheckout: 0,
penaltyPoint: 0,
},
{
id: 2,
nickName: 'Jamie',
status: 'warning',
dateOfSubscription: '2022.10.22',
periodOfActivity: 0,
uncheckin: 0,
uncheckout: 10,
penaltyPoint: 990,
},
{
id: 3,
nickName: 'Park',
status: 'member',
dateOfSubscription: '2022.10.22',
periodOfActivity: 0,
uncheckin: 0,
uncheckout: 0,
penaltyPoint: 0,
},
];
const STATUS = {
member: {
text: '활동 중',
color: 'primary',
},
waiting: {
text: '가입 승인 대기 중',
color: 'fontColor',
},
warning: {
text: '벌점 초과',
color: 'warning',
},
danger: {
text: '경고 대상',
color: 'danger',
},
};
export const MemberManagementList: ComponentStory<typeof Table> = () => (
<Table
caption="스터디 멤버 관리"
columnsWidth={['*', '15%', '15%', '13%', '13%', '13%', '13%']}
>
<Table.Head>
<Table.Row>
<Table.HeadCell>닉네임</Table.HeadCell>
<Table.HeadCell>상태</Table.HeadCell>
<Table.HeadCell>가입일</Table.HeadCell>
<Table.HeadCell>활동일</Table.HeadCell>
<Table.HeadCell>
미 체크인
<Icon iconName="star" size="large" />
</Table.HeadCell>
<Table.HeadCell>
미 체크아웃
<Icon iconName="star" size="large" />
</Table.HeadCell>
<Table.HeadCell>벌점</Table.HeadCell>
</Table.Row>
</Table.Head>
<Table.Body>
{memberManagementList.map((props) => (
<Table.Row key={props.id}>
<Table.BodyCell sx={{ justifyContent: 'flex-start' }}>
<Icon iconName="anonymous" size="large" color="borderLine" />
<Text ellipsis>{props.nickName}</Text>
</Table.BodyCell>
<Table.BodyCell>
<Text ellipsis>
<Text.Highlight
as="strong"
sx={{ fontWeight: 'bold', color: STATUS[props.status].color }}
>
{STATUS[props.status].text}
</Text.Highlight>
</Text>
</Table.BodyCell>
<Table.BodyCell>
<Text ellipsis>{props.dateOfSubscription}</Text>
</Table.BodyCell>
<Table.BodyCell>
<Text ellipsis>{props.periodOfActivity}일</Text>
</Table.BodyCell>
<Table.BodyCell>
<Text ellipsis>{props.uncheckin}회</Text>
</Table.BodyCell>
<Table.BodyCell>
<Text ellipsis>{props.uncheckout}회</Text>
</Table.BodyCell>
<Table.BodyCell>
<Text ellipsis>{props.penaltyPoint}점</Text>
</Table.BodyCell>
</Table.Row>
))}
</Table.Body>
</Table>
);