From 7ff010ef5cc872a1640231ee45631523b22404dd Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Mon, 6 May 2024 12:24:03 -0700 Subject: [PATCH] Added button component --- Client/src/Components/Button/index.css | 0 Client/src/Components/Button/index.jsx | 45 ++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 Client/src/Components/Button/index.css create mode 100644 Client/src/Components/Button/index.jsx diff --git a/Client/src/Components/Button/index.css b/Client/src/Components/Button/index.css new file mode 100644 index 000000000..e69de29bb diff --git a/Client/src/Components/Button/index.jsx b/Client/src/Components/Button/index.jsx new file mode 100644 index 000000000..b9a4d7e14 --- /dev/null +++ b/Client/src/Components/Button/index.jsx @@ -0,0 +1,45 @@ +import { Button as MuiButton } from "@mui/material"; +import PropTypes from "prop-types"; + +const levelConfig = { + primary: { + variant: "contained", + color: "primary", + }, + secondary: { + variant: "outlined", + color: "secondary", + }, + tertiary: { + variant: "text", + color: "tertiary", + }, + error: { + variant: "contained", + color: "error", + }, +}; + +/** + * @typedef {Object} Props + * @property {'primary' | 'secondary' | 'tertiary' | 'error'} level - The level of the button + * @property {string} label - The label of the button + * @property {boolean} [disabled] - Whether the button is disabled + */ + +const Button = ({ level, value, disabled }) => { + const { variant, color } = levelConfig[level]; + return ( + + {value} + + ); +}; + +Button.propTypes = { + level: PropTypes.string.isRequired, + value: PropTypes.string.isRequired, + disabled: PropTypes.bool, +}; + +export default Button;