BlockChecbox.js 669 B

1234567891011121314151617181920212223242526272829
  1. import { Icon } from 'antd';
  2. import React from 'react';
  3. import style from './index.less';
  4. const BlockChecbox = ({ value, onChange, list }) => (
  5. <div className={style.blockChecbox} key={value}>
  6. {list.map(item => (
  7. <div
  8. key={item.key}
  9. className={style.item}
  10. onClick={() => {
  11. onChange(item.key);
  12. }}
  13. >
  14. <img src={item.url} alt={item.key} />
  15. <div
  16. className={style.selectIcon}
  17. style={{
  18. display: value === item.key ? 'block' : 'none',
  19. }}
  20. >
  21. <Icon type="check" />
  22. </div>
  23. </div>
  24. ))}
  25. </div>
  26. );
  27. export default BlockChecbox;