Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit 10e609b

Browse files
committed
refactor(usersTable): adjust litte
1 parent 810893b commit 10e609b

File tree

2 files changed

+30
-17
lines changed

2 files changed

+30
-17
lines changed

components/MaybeCell/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,26 @@ const debug = makeDebugger('c:MaybeCell:index')
1414
/* eslint-enable no-unused-vars */
1515

1616
export const NoneText = styled.div`
17-
text-align: center;
17+
text-align: ${({ align }) => align};
1818
font-size: 0.8rem;
1919
color: lightgrey;
2020
font-style: italic;
2121
`
22-
const MaybeCell = ({ text }) => {
22+
const MaybeCell = ({ text, align }) => {
2323
if (isEmptyNil(text)) {
24-
return <NoneText>暂无</NoneText>
24+
return <NoneText align={align}>--</NoneText>
2525
}
2626
return <div>{text}</div>
2727
}
2828

2929
MaybeCell.propTypes = {
3030
text: PropTypes.string,
31+
align: PropTypes.oneOf(['left', 'center', 'right']),
3132
}
3233

3334
MaybeCell.defaultProps = {
3435
text: '',
36+
align: 'center',
3537
}
3638

3739
export default MaybeCell

components/UsersTable/index.js

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,29 @@ class UsersTable extends React.PureComponent {
4747
return <UserCell user={user} left="20px" />
4848
},
4949
},
50+
{
51+
title: '城市',
52+
dataIndex: 'location',
53+
align: 'left',
54+
width: 120,
55+
render: text => <MaybeCell text={text} align="left" />,
56+
},
57+
{
58+
title: 'email',
59+
dataIndex: 'email',
60+
align: 'left',
61+
width: 150,
62+
render: text => <MaybeCell text={text} align="left" />,
63+
},
64+
{
65+
title: '社交账号',
66+
dataIndex: 'social',
67+
align: 'center',
68+
width: 150,
69+
render: () => {
70+
return <div>hello</div>
71+
},
72+
},
5073
{
5174
title: '关注社区',
5275
dataIndex: 'subscribedCommunitiesCount',
@@ -80,20 +103,6 @@ class UsersTable extends React.PureComponent {
80103
<PermissionCell source={record} onMutate={cmsPermisstionOnChange} />
81104
),
82105
},
83-
{
84-
title: 'email',
85-
dataIndex: 'email',
86-
align: 'center',
87-
width: 100,
88-
render: text => <MaybeCell text={text} />,
89-
},
90-
{
91-
title: '位置',
92-
dataIndex: 'location',
93-
align: 'center',
94-
width: 220,
95-
render: text => <MaybeCell text={text} />,
96-
},
97106
{
98107
title: '时间戳',
99108
width: 120,
@@ -106,6 +115,8 @@ class UsersTable extends React.PureComponent {
106115
render() {
107116
const { data, loading, pageOnChange } = this.props
108117

118+
console.log('UsersTable data: ', data)
119+
109120
return (
110121
<React.Fragment>
111122
{data ? (

0 commit comments

Comments
 (0)