This repository was archived by the owner on Nov 1, 2021. It is now read-only.
File tree 4 files changed +72
-3
lines changed
4 files changed +72
-3
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ *
3
+ * SocialSell
4
+ *
5
+ */
6
+
7
+ import React from 'react'
8
+ import PropTypes from 'prop-types'
9
+ import R from 'ramda'
10
+
11
+ import { ICON_CMD } from 'config'
12
+ import { makeDebugger } from 'utils'
13
+
14
+ import { Wrapper , SocalIcon } from './styles'
15
+
16
+ /* eslint-disable-next-line */
17
+ const debug = makeDebugger ( 'c:SocialSell:index' )
18
+
19
+ const SocialSell = ( { data } ) => {
20
+ const validList = [ ]
21
+
22
+ R . forEachObjIndexed ( ( v , k ) => {
23
+ if ( v ) {
24
+ validList . push ( { social : k , value : v } )
25
+ }
26
+ } , data )
27
+
28
+ return (
29
+ < Wrapper >
30
+ { validList . map ( item => (
31
+ < div key = { item . social } >
32
+ < a href = { item . value } target = "_blank" rel = "noopener noreferrer" >
33
+ < SocalIcon src = { `${ ICON_CMD } /${ item . social } .svg` } />
34
+ </ a >
35
+ </ div >
36
+ ) ) }
37
+ </ Wrapper >
38
+ )
39
+ }
40
+
41
+ SocialSell . propTypes = {
42
+ data : PropTypes . object . isRequired ,
43
+ }
44
+
45
+ SocialSell . defaultProps = { }
46
+
47
+ export default React . memo ( SocialSell )
Original file line number Diff line number Diff line change
1
+ import styled from 'styled-components'
2
+
3
+ import Img from 'Img'
4
+ // import { theme } from '@utils'
5
+
6
+ export const Wrapper = styled . div ``
7
+ export const Title = styled . div ``
8
+
9
+ export const SocalIcon = styled ( Img ) `
10
+ width: 15px;
11
+ height: 15px;
12
+ display: block;
13
+ `
Original file line number Diff line number Diff line change
1
+ // import React from 'react'
2
+ // import { shallow } from 'enzyme'
3
+
4
+ // import SocialSell from '../index'
5
+
6
+ describe ( 'TODO <SocialSell />' , ( ) => {
7
+ it ( 'Expect to have unit tests specified' , ( ) => {
8
+ expect ( true ) . toEqual ( true )
9
+ } )
10
+ } )
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import Pagi from '../Pagi'
13
13
import { TableLoading } from '../LoadingEffects'
14
14
import MaybeCell from '../MaybeCell'
15
15
import UserCell from '../UserCell'
16
+ import SocialSell from '../SocialSell'
16
17
import TimeStampCell from '../TimeStampCell'
17
18
18
19
import PermissionCell from '../PermissionCell'
@@ -66,9 +67,7 @@ class UsersTable extends React.PureComponent {
66
67
dataIndex : 'social' ,
67
68
align : 'center' ,
68
69
width : 150 ,
69
- render : ( ) => {
70
- return < div > hello</ div >
71
- } ,
70
+ render : data => < SocialSell data = { data } /> ,
72
71
} ,
73
72
{
74
73
title : '关注社区' ,
You can’t perform that action at this time.
0 commit comments