Added some basic button svg animations

This commit is contained in:
Daniel Cojocea committed 2024-07-30 19:36:37 -04:00
1 parent dd834fc2c5
commit a0f54c191e
8 files changed
+84 -15

No files matched your search

+15 -3
View File
@@ -1,5 +1,6 @@
import { Button as MuiButton } from "@mui/material";
import PropTypes from "prop-types";
import "./index.css";
const levelConfig = {
primary: {
@@ -48,11 +49,22 @@ const levelConfig = {
* <Button type="submit" level="error" label="Error" disabled sx={{marginTop: "1rem"}}/>
*/
const Button = ({ id, type, level, label, disabled, img, onClick, sx }) => {
const Button = ({
id,
animate,
type,
level,
label,
disabled,
img,
onClick,
sx,
}) => {
const { variant, color } = levelConfig[level];
return (
<MuiButton
id={id}
className={`button-${animate}`}
type={type}
variant={variant}
color={color}
@@ -60,6 +72,7 @@ const Button = ({ id, type, level, label, disabled, img, onClick, sx }) => {
onClick={onClick}
disableRipple
sx={{
lineHeight: 1,
boxShadow: "none",
textTransform: "none",
"&:focus": {
@@ -67,13 +80,12 @@ const Button = ({ id, type, level, label, disabled, img, onClick, sx }) => {
},
"&:hover": {
boxShadow: "none",
transition: "none"
},
...sx,
}}
>
{img && img}
{label}
<span>{label}</span>
</MuiButton>
);
};