next-material-kit
Version:
NextJS Version of Material Kit React by Creative Tim (https://creative-tim.com)
85 lines (75 loc) • 1.82 kB
JavaScript
import React from "react";
// nodejs library to set properties for components
import PropTypes from "prop-types";
// nodejs library that concatenates classes
import classNames from "classnames";
// @material-ui/core components
import makeStyles from "@material-ui/core/styles/makeStyles";
import Button from "@material-ui/core/Button";
// core components
import buttonStyle from "styles/jss/nextjs-material-kit/components/buttonStyle.js";
const makeComponentStyles = makeStyles(() => ({
...buttonStyle,
}));
const RegularButton = React.forwardRef((props, ref) => {
const {
color,
round,
children,
fullWidth,
disabled,
simple,
size,
block,
link,
justIcon,
className,
...rest
} = props;
const classes = makeComponentStyles();
const btnClasses = classNames({
[]: true,
[]]: size,
[]]: color,
[]: round,
[]: fullWidth,
[]: disabled,
[]: simple,
[]: block,
[]: link,
[]: justIcon,
[]: className,
});
return (
<Button {...rest} ref={ref} classes={{ root: btnClasses }}>
{children}
</Button>
);
});
RegularButton.propTypes = {
color: PropTypes.oneOf([
"primary",
"info",
"success",
"warning",
"danger",
"rose",
"white",
"facebook",
"twitter",
"google",
"github",
"transparent",
]),
size: PropTypes.oneOf(["sm", "lg"]),
simple: PropTypes.bool,
round: PropTypes.bool,
fullWidth: PropTypes.bool,
disabled: PropTypes.bool,
block: PropTypes.bool,
link: PropTypes.bool,
justIcon: PropTypes.bool,
children: PropTypes.node,
className: PropTypes.string,
};
export default RegularButton;