This repository was archived by the owner on Nov 1, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +30
-17
lines changed Expand file tree Collapse file tree 2 files changed +30
-17
lines changed Original file line number Diff line number Diff line change @@ -14,24 +14,26 @@ const debug = makeDebugger('c:MaybeCell:index')
14
14
/* eslint-enable no-unused-vars */
15
15
16
16
export const NoneText = styled . div `
17
- text-align: center ;
17
+ text-align: ${ ( { align } ) => align } ;
18
18
font-size: 0.8rem;
19
19
color: lightgrey;
20
20
font-style: italic;
21
21
`
22
- const MaybeCell = ( { text } ) => {
22
+ const MaybeCell = ( { text, align } ) => {
23
23
if ( isEmptyNil ( text ) ) {
24
- return < NoneText > 暂无 </ NoneText >
24
+ return < NoneText align = { align } > -- </ NoneText >
25
25
}
26
26
return < div > { text } </ div >
27
27
}
28
28
29
29
MaybeCell . propTypes = {
30
30
text : PropTypes . string ,
31
+ align : PropTypes . oneOf ( [ 'left' , 'center' , 'right' ] ) ,
31
32
}
32
33
33
34
MaybeCell . defaultProps = {
34
35
text : '' ,
36
+ align : 'center' ,
35
37
}
36
38
37
39
export default MaybeCell
Original file line number Diff line number Diff line change @@ -47,6 +47,29 @@ class UsersTable extends React.PureComponent {
47
47
return < UserCell user = { user } left = "20px" />
48
48
} ,
49
49
} ,
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
+ } ,
50
73
{
51
74
title : '关注社区' ,
52
75
dataIndex : 'subscribedCommunitiesCount' ,
@@ -80,20 +103,6 @@ class UsersTable extends React.PureComponent {
80
103
< PermissionCell source = { record } onMutate = { cmsPermisstionOnChange } />
81
104
) ,
82
105
} ,
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
- } ,
97
106
{
98
107
title : '时间戳' ,
99
108
width : 120 ,
@@ -106,6 +115,8 @@ class UsersTable extends React.PureComponent {
106
115
render ( ) {
107
116
const { data, loading, pageOnChange } = this . props
108
117
118
+ console . log ( 'UsersTable data: ' , data )
119
+
109
120
return (
110
121
< React . Fragment >
111
122
{ data ? (
You can’t perform that action at this time.
0 commit comments