BlockCheckbox.js 698 Bytes
Newer Older
jim's avatar
jim committed
1
import React from 'react';
afc163's avatar
afc163 committed
2
import { Tooltip, Icon } from 'antd';
jim's avatar
jim committed
3 4
import style from './index.less';

5 6 7
const BlockChecbox = ({ value, onChange, list }) => (
  <div className={style.blockChecbox} key={value}>
    {list.map(item => (
afc163's avatar
afc163 committed
8 9 10 11 12 13 14 15 16 17 18
      <Tooltip title={item.title} key={item.key}>
        <div className={style.item} onClick={() => onChange(item.key)}>
          <img src={item.url} alt={item.key} />
          <div
            className={style.selectIcon}
            style={{
              display: value === item.key ? 'block' : 'none',
            }}
          >
            <Icon type="check" />
          </div>
19
        </div>
afc163's avatar
afc163 committed
20
      </Tooltip>
21 22 23
    ))}
  </div>
);
jim's avatar
jim committed
24 25

export default BlockChecbox;