Update themed components with refs and css
This commit is contained in:
@@ -1,47 +1,50 @@
|
||||
import type { ButtonProps } from "$/types/ButtonTypes";
|
||||
import clsx from "clsx";
|
||||
import { forwardRef } from "react";
|
||||
import Button from "./Button";
|
||||
|
||||
|
||||
export default function TertiaryButton(props: ButtonProps){
|
||||
const {
|
||||
className,
|
||||
variant = "standard",
|
||||
disabled
|
||||
} = props;
|
||||
|
||||
|
||||
const TertiaryButton = forwardRef<HTMLButtonElement, ButtonProps>(({
|
||||
className,
|
||||
variant = "standard",
|
||||
disabled,
|
||||
...buttonProps
|
||||
}, ref) => {
|
||||
return (
|
||||
<Button
|
||||
data-testid="mattrixwv-tertiary-button"
|
||||
{...props}
|
||||
{...buttonProps}
|
||||
ref={ref}
|
||||
variant={variant}
|
||||
disabled={disabled}
|
||||
className={clsx(
|
||||
"transition duration-300",
|
||||
className,
|
||||
//Background
|
||||
{
|
||||
"bg-purple-600 hover:bg-purple-700 active:bg-purple-800": (variant === "standard") && (!disabled),
|
||||
"bg-purple-400/80": (variant === "standard") && (disabled),
|
||||
"bg-tertiary active:bg-tertiary-dark": (variant === "standard") && (!disabled),
|
||||
"bg-tertiary-light/80": (variant === "standard") && (disabled),
|
||||
"bg-transparent": (variant === "outline" || variant === "icon"),
|
||||
"bg-transparent hover:bg-purple-600 active:bg-purple-700": (variant === "ghost" || variant === "outline-ghost") && (!disabled),
|
||||
"bg-transparent hover:bg-tertiary active:bg-tertiary-dark": (variant === "ghost" || variant === "outline-ghost") && (!disabled),
|
||||
"bg-transparent ": (variant === "ghost" || variant === "outline-ghost") && (disabled)
|
||||
},
|
||||
//Outline
|
||||
{
|
||||
"border-purple-600 hover:border-purple-700 active:border-purple-800": (variant === "standard" || variant === "outline") && (!disabled),
|
||||
"border-purple-400/80": (variant === "standard" || variant === "outline") && (disabled),
|
||||
"border-purple-600 hover:border-purple-600 active:border-purple-700": (variant === "outline-ghost") && (!disabled),
|
||||
"border-purple-400/80 ": (variant === "outline-ghost") && (disabled)
|
||||
"border-tertiary active:border-tertiary-dark": (variant === "standard" || variant === "outline" || variant === "outline-ghost") && (!disabled),
|
||||
"border-tertiary-light/80": (variant === "standard" || variant === "outline" || variant === "outline-ghost") && (disabled)
|
||||
},
|
||||
//Text
|
||||
{
|
||||
"text-white": variant === "standard",
|
||||
"text-purple-600 hover:text-purple-700 active:text-purple-800": (variant === "outline" || variant === "icon") && (!disabled),
|
||||
"text-purple-400/80": (variant === "outline" || variant === "icon") && (disabled),
|
||||
"text-purple-600 hover:text-white active:text-white": (variant === "ghost" || variant === "outline-ghost") && (!disabled),
|
||||
"text-purple-400/80 ": (variant === "ghost" || variant === "outline-ghost") && (disabled)
|
||||
"text-tertiary active:text-tertiary-dark": (variant === "outline" || variant === "icon") && (!disabled),
|
||||
"text-tertiary-light/80": (variant === "outline" || variant === "icon" || variant === "ghost" || variant === "outline-ghost") && (disabled),
|
||||
"text-tertiary hover:text-white active:text-white": (variant === "ghost" || variant === "outline-ghost") && (!disabled)
|
||||
}
|
||||
)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
TertiaryButton.displayName = "TertiaryButton";
|
||||
|
||||
export default TertiaryButton;
|
||||
|
||||
Reference in New Issue
Block a user