Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

classnames

import React from "react";
import CN from "classnames";
import { Button, makeStyles } from "@material-ui/core";
const Buttons = ({ colorPink, colorOrange }) => {
  const classes = useStyles();
  return (
    <Button
      className={CN({
        [classes.colorPink]: colorPink,
        [classes.colorOrange]: colorOrange,
      })}
      variant="contained"
    >
      Hello buttons
    </Button>
  );
};
export default Buttons;
const useStyles = makeStyles(() => ({
  colorPink: {
    color: "white",
    backgroundColor: "pink",
  },
  colorOrange: {
    color: "white",
    backgroundColor: "orange",
  },
}));
 
PREVIOUS NEXT
Tagged: #classnames
ADD COMMENT
Topic
Name
7+1 =