BlockChecbox.js 789 Bytes
Newer Older
jim's avatar
jim committed
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
import { Icon } from 'antd';
import React from 'react';
import style from './index.less';

const BlockChecbox = ({ value, onChange, list }) => {
  return (
    <div className={style.blockChecbox} key={value}>
      {list.map(item => {
        return (
          <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>
  );
};

export default BlockChecbox;