index.js 549 B

12345678910111213141516171819202122
  1. import React from 'react';
  2. import './index.less';
  3. import Button from '../Button';
  4. function RadioButton(props) {
  5. const { list, checked, onChange } = props;
  6. return (
  7. <div className="radio-button">
  8. {list.map(item => {
  9. return (
  10. <Button theme={item.key === checked ? 'theme' : 'default'} size="small" radius onClick={() => {
  11. if (onChange) onChange(item);
  12. }}>
  13. {item.title}
  14. </Button>
  15. );
  16. })}
  17. </div>
  18. );
  19. }
  20. RadioButton.propTypes = {};
  21. export default RadioButton;