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

Commit 40bc04f

Browse files
committed
feat(usersTable): add social cell
1 parent 1510053 commit 40bc04f

File tree

4 files changed

+72
-3
lines changed

4 files changed

+72
-3
lines changed

components/SocialSell/index.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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)

components/SocialSell/styles/index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
`
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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+
})

components/UsersTable/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import Pagi from '../Pagi'
1313
import { TableLoading } from '../LoadingEffects'
1414
import MaybeCell from '../MaybeCell'
1515
import UserCell from '../UserCell'
16+
import SocialSell from '../SocialSell'
1617
import TimeStampCell from '../TimeStampCell'
1718

1819
import PermissionCell from '../PermissionCell'
@@ -66,9 +67,7 @@ class UsersTable extends React.PureComponent {
6667
dataIndex: 'social',
6768
align: 'center',
6869
width: 150,
69-
render: () => {
70-
return <div>hello</div>
71-
},
70+
render: data => <SocialSell data={data} />,
7271
},
7372
{
7473
title: '关注社区',

0 commit comments

Comments
 (0)