Removed button component
This commit is contained in:
1 parent
cca02d30b9
commit
9fc2d5c33a
2 files changed
-130
No files matched your search
@@ -1,33 +0,0 @@
|
|||||||
.MuiButtonBase-root.button-rotate90 svg {
|
|
||||||
transition: transform 500ms ease;
|
|
||||||
}
|
|
||||||
.MuiButtonBase-root.button-rotate90:hover svg {
|
|
||||||
transform: rotate(90deg);
|
|
||||||
transform-origin: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.MuiButtonBase-root.button-rotate180 svg {
|
|
||||||
transition: transform 700ms ease;
|
|
||||||
}
|
|
||||||
.MuiButtonBase-root.button-rotate180:hover svg {
|
|
||||||
transform: rotate(180deg);
|
|
||||||
transform-origin: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.MuiButtonBase-root.button-slideLeft {
|
|
||||||
padding-left: 45px;
|
|
||||||
}
|
|
||||||
.MuiButtonBase-root.button-slideLeft svg {
|
|
||||||
position: absolute;
|
|
||||||
left: 15px;
|
|
||||||
transition: left 250ms cubic-bezier(0.65, 0, 0.076, 1);
|
|
||||||
}
|
|
||||||
.MuiButtonBase-root.button-slideLeft:hover svg {
|
|
||||||
left: 11px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.MuiButtonBase-root.button-slideLeft:hover,
|
|
||||||
.MuiButtonBase-root.button-rotate180:hover,
|
|
||||||
.MuiButtonBase-root.button-rotate90:hover {
|
|
||||||
background-color: rgba(71, 84, 103, 0.08);
|
|
||||||
}
|
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
import { Button as MuiButton } from "@mui/material";
|
|
||||||
import PropTypes from "prop-types";
|
|
||||||
import "./index.css";
|
|
||||||
|
|
||||||
const levelConfig = {
|
|
||||||
primary: {
|
|
||||||
variant: "contained",
|
|
||||||
color: "primary",
|
|
||||||
},
|
|
||||||
secondary: {
|
|
||||||
variant: "outlined",
|
|
||||||
color: "secondary",
|
|
||||||
},
|
|
||||||
tertiary: {
|
|
||||||
variant: "text",
|
|
||||||
color: "tertiary",
|
|
||||||
},
|
|
||||||
error: {
|
|
||||||
variant: "contained",
|
|
||||||
color: "error",
|
|
||||||
},
|
|
||||||
imagePrimary: {
|
|
||||||
color: "primary",
|
|
||||||
variant: "text",
|
|
||||||
},
|
|
||||||
imageSecondary: {
|
|
||||||
color: "secondary",
|
|
||||||
variant: "text",
|
|
||||||
},
|
|
||||||
imageTertiary: {
|
|
||||||
color: "tertiary",
|
|
||||||
variant: "text",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @component
|
|
||||||
* @param {Object} props
|
|
||||||
* @param {'primary' | 'secondary' | 'tertiary' | 'error' | 'imagePrimary' | 'imageSecondary' | 'imageTertiary'} props.level - The level of the button
|
|
||||||
* @param {string} props.type - The type of the button
|
|
||||||
* @param {string} props.label - The label of the button
|
|
||||||
* @param {React.ReactNode} props.img - Image for button
|
|
||||||
* @param {boolean} [props.disabled] - Whether the button is disabled
|
|
||||||
* @param {function} props.onClick - Function to run when the button is clicked
|
|
||||||
* @param {Object} props.sx - Styles for the button
|
|
||||||
* @returns {JSX.Element}
|
|
||||||
* @example
|
|
||||||
* // Render an error button
|
|
||||||
* <Button type="submit" level="error" label="Error" disabled sx={{marginTop: "1rem"}}/>
|
|
||||||
*/
|
|
||||||
|
|
||||||
const Button = ({
|
|
||||||
id,
|
|
||||||
animate,
|
|
||||||
type,
|
|
||||||
level,
|
|
||||||
label,
|
|
||||||
disabled,
|
|
||||||
img,
|
|
||||||
onClick,
|
|
||||||
props,
|
|
||||||
sx,
|
|
||||||
}) => {
|
|
||||||
const { variant, color } = levelConfig[level];
|
|
||||||
return (
|
|
||||||
<MuiButton
|
|
||||||
id={id}
|
|
||||||
className={`button-${animate}`}
|
|
||||||
type={type}
|
|
||||||
variant={variant}
|
|
||||||
color={color}
|
|
||||||
disabled={disabled}
|
|
||||||
onClick={onClick}
|
|
||||||
disableRipple
|
|
||||||
sx={{
|
|
||||||
...sx,
|
|
||||||
}}
|
|
||||||
{...props}
|
|
||||||
>
|
|
||||||
{img && img}
|
|
||||||
<span>{label}</span>
|
|
||||||
</MuiButton>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
Button.propTypes = {
|
|
||||||
id: PropTypes.string,
|
|
||||||
type: PropTypes.string,
|
|
||||||
level: PropTypes.string.isRequired,
|
|
||||||
label: PropTypes.string.isRequired,
|
|
||||||
img: PropTypes.node,
|
|
||||||
onClick: PropTypes.func,
|
|
||||||
sx: PropTypes.object,
|
|
||||||
disabled: PropTypes.bool,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Button;
|
|
||||||
Reference in new issue
Block a user