Skip to content

Commit

Permalink
Fix Cypress error
Browse files Browse the repository at this point in the history
  • Loading branch information
LuizFNJ committed Feb 15, 2025
1 parent e6d5662 commit 67e607a
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions src/components/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { Button, ButtonProps } from "@mui/material";
import { Button, ButtonProps } from "antd";
import colors from "../styles/colors";
import { useAtom } from "jotai";
import { currentNameSpace } from "../atoms/namespace";
import { NameSpaceEnum } from "../types/Namespace";
import { useLayoutEffect, useState } from "react";

export enum ButtonType {
blue = "blue",
white = "white",
Expand All @@ -13,33 +12,26 @@ export enum ButtonType {
whiteBlack = "whiteBlack",
lightBlue = "lightBlue",
}

type AletheiaButtonProps = Omit<ButtonProps, "type">;
interface IAletheiaButtonProps extends AletheiaButtonProps {
type?: ButtonType;
event?: any;
rounded?: string;
loading?: boolean;
htmlType?: "button" | "submit" | "reset";
icon?: any;
target?: "_blank" | "_self" | "_parent" | "_top";
}

const AletheiaButton: React.FC<IAletheiaButtonProps> = (props) => {
const { children, type, rounded, htmlType, style, ...restProps } = props;

const AletheiaButton: (props: IAletheiaButtonProps) => JSX.Element = (
props: IAletheiaButtonProps
) => {
const [nameSpace] = useAtom(currentNameSpace);

const [backgroundColor, setBackgroundColor] = useState(colors.primary);

useLayoutEffect(() => {
setBackgroundColor(
nameSpace === NameSpaceEnum.Main
? colors.primary
: colors.secondary
);
}, [nameSpace]);

let buttonStyle = {
borderWidth: "2px",
display: "flex",
Expand Down Expand Up @@ -103,10 +95,9 @@ const AletheiaButton: React.FC<IAletheiaButtonProps> = (props) => {
}

return (
<Button type={htmlType || "button"} variant="outlined" style={buttonStyle} {...restProps}>
{children}
<Button {...props} type="default" style={buttonStyle}>
{props.children}
</Button>
);
};

export default AletheiaButton;
export default AletheiaButton;

0 comments on commit 67e607a

Please sign in to comment.