import React from "react"; import "./button-styles.scss"; import { Oval } from "react-loader-spinner"; import { ButtonProps } from "@app/models/components"; const Button: React.FC = ({ id = "", onClickHandler, text, type = "button", disabled = false, variant, isDestructive, isLoading, icon, iconPosition = "start", shape = "boxy", style = {}, size = "md", collapse, href = "", target = "_self", }) => { let buttonClassName = "button-root"; if (variant === "tertiary") { buttonClassName += " tertiary-button"; } else if (variant === "secondary") { buttonClassName += " secondary-button"; } else if (variant === "ghost") { buttonClassName += " ghost-button"; } if (isDestructive) { buttonClassName += " destructive-button"; } if (shape === "rounded") { buttonClassName += " rounded-button"; } if (shape === "circular") { buttonClassName += " circular-button"; } if (size === "lg") { buttonClassName += " large-button"; } if (collapse) { buttonClassName += " collapse"; } return ( <> {(text || icon) && type == "link" && href ? ( {iconPosition == "start" && icon} {text} {iconPosition == "end" && icon} ) : ( (onClickHandler || type == "submit") && (text || icon) && type != "link" && ( ) )} ); }; export default Button;