index.tsx 872 B

12345678910111213141516171819202122232425262728293031323334
  1. import React, { ReactElement } from 'react';
  2. import Button from '@material/react-button';
  3. import IconButton from '@material/react-icon-button';
  4. import MaterialIcon from '@material/react-material-icon';
  5. import '@material/react-button/dist/button.css';
  6. import '@material/react-icon-button/dist/icon-button.css'
  7. import '@material/react-material-icon/dist/material-icon.css';
  8. type CBKButtonProps = {
  9. children: string|ReactElement,
  10. className?: string,
  11. unelevated?: boolean,
  12. raised?: boolean,
  13. outlined?: boolean,
  14. icon?: string,
  15. onClick?: () => void,
  16. }
  17. export default function CBKButton(props: any) {
  18. if (props.icon) {
  19. return (
  20. <IconButton onClick={props.onClick} {...props}>
  21. <MaterialIcon icon={props.icon}/>
  22. </IconButton>
  23. );
  24. } else {
  25. return (
  26. <Button {...props}>
  27. { props.children }
  28. </Button>
  29. )
  30. }
  31. };