Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

85 рядки
1.8 KiB

  1. import React from "react";
  2. // nodejs library to set properties for components
  3. import PropTypes from "prop-types";
  4. // nodejs library that concatenates classes
  5. import classNames from "classnames";
  6. // @material-ui/core components
  7. import makeStyles from "@material-ui/core/styles/makeStyles";
  8. import Button from "@material-ui/core/Button";
  9. // core components
  10. import buttonStyle from "assets/jss/nextjs-material-kit/components/buttonStyle.js";
  11. const makeComponentStyles = makeStyles(() => ({
  12. ...buttonStyle
  13. }));
  14. const RegularButton = React.forwardRef((props, ref) => {
  15. const {
  16. color,
  17. round,
  18. children,
  19. fullWidth,
  20. disabled,
  21. simple,
  22. size,
  23. block,
  24. link,
  25. justIcon,
  26. className,
  27. ...rest
  28. } = props;
  29. const classes = makeComponentStyles();
  30. const btnClasses = classNames({
  31. [classes.button]: true,
  32. [classes[size]]: size,
  33. [classes[color]]: color,
  34. [classes.round]: round,
  35. [classes.fullWidth]: fullWidth,
  36. [classes.disabled]: disabled,
  37. [classes.simple]: simple,
  38. [classes.block]: block,
  39. [classes.link]: link,
  40. [classes.justIcon]: justIcon,
  41. [className]: className
  42. });
  43. return (
  44. <Button {...rest} ref={ref} classes={{ root: btnClasses }}>
  45. {children}
  46. </Button>
  47. );
  48. });
  49. RegularButton.propTypes = {
  50. color: PropTypes.oneOf([
  51. "primary",
  52. "info",
  53. "success",
  54. "warning",
  55. "danger",
  56. "rose",
  57. "white",
  58. "facebook",
  59. "twitter",
  60. "google",
  61. "github",
  62. "transparent"
  63. ]),
  64. size: PropTypes.oneOf(["sm", "lg"]),
  65. simple: PropTypes.bool,
  66. round: PropTypes.bool,
  67. fullWidth: PropTypes.bool,
  68. disabled: PropTypes.bool,
  69. block: PropTypes.bool,
  70. link: PropTypes.bool,
  71. justIcon: PropTypes.bool,
  72. children: PropTypes.node,
  73. className: PropTypes.string
  74. };
  75. export default RegularButton;