BlockChecbox.js 669 Bytes
Newer Older
jim's avatar
jim committed
1 2 3 4
import { Icon } from 'antd';
import React from 'react';
import style from './index.less';

5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
const BlockChecbox = ({ value, onChange, list }) => (
  <div className={style.blockChecbox} key={value}>
    {list.map(item => (
      <div
        key={item.key}
        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>
      </div>
    ))}
  </div>
);
jim's avatar
jim committed
28 29

export default BlockChecbox;