index.js
1.19 KB
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
import React from 'react'
import { Row, Col} from 'antd';
import IconConfig from './../../../config/IconConfig'
import './index.less'
class IconOptionsForm extends React.Component {
state = {}
selectedUser= (data)=> {
console.log(data);
if (data) {
this.props.getIconObj(
data
)
}
this.setState({
iconCheckedObj: data
})
}
renderIconLists = (data) => {
const iconCheckedObj = this.props.iconCheckedObj
let _this = this
return data.map(
function (item ,index) {
item.key = index
return <Col key={index} className="iconCol"span={4} style={{backgroundColor:(iconCheckedObj == item.name ) ? "#00a0e9" : "#fff"}} onClick={()=>{_this.selectedUser(item.name)}}>
<div className={ ` iconfont ${item.className}`}></div>
<div>{item.name}</div>
</Col>
}
)
}
render(){
return(
<div className="iconlist">
<div className="iconRow">
<Row type="flex" justify="left" align="middle">
{this.renderIconLists(IconConfig)}
</Row>
</div>
</div>
)
}
}
export default IconOptionsForm