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 InfoButton(props: ButtonProps){
|
||||
const {
|
||||
className,
|
||||
variant = "standard",
|
||||
disabled
|
||||
} = props;
|
||||
|
||||
|
||||
const InfoButton = forwardRef<HTMLButtonElement, ButtonProps>(({
|
||||
className,
|
||||
variant = "standard",
|
||||
disabled,
|
||||
...buttonProps
|
||||
}, ref) => {
|
||||
return (
|
||||
<Button
|
||||
data-testid="mattrixwv-info-button"
|
||||
{...props}
|
||||
{...buttonProps}
|
||||
variant={variant}
|
||||
disabled={disabled}
|
||||
ref={ref}
|
||||
className={clsx(
|
||||
"transition duration-300",
|
||||
className,
|
||||
//Background
|
||||
{
|
||||
"bg-cyan-500 hover:bg-cyan-600 active:bg-cyan-700": (variant === "standard") && (!disabled),
|
||||
"bg-sky-300/80": (variant === "standard") && (disabled),
|
||||
"bg-info active:bg-info-dark": (variant === "standard") && (!disabled),
|
||||
"bg-info-light/80": (variant === "standard") && (disabled),
|
||||
"bg-transparent": (variant === "outline" || variant === "icon"),
|
||||
"bg-transparent hover:bg-cyan-500 active:bg-cyan-600": (variant === "ghost" || variant === "outline-ghost") && (!disabled),
|
||||
"bg-transparent hover:bg-info active:bg-info-dark": (variant === "ghost" || variant === "outline-ghost") && (!disabled),
|
||||
"bg-transparent ": (variant === "ghost" || variant === "outline-ghost") && (disabled)
|
||||
},
|
||||
//Outline
|
||||
{
|
||||
"border-cyan-500 hover:border-cyan-600 active:border-cyan-700": (variant === "standard" || variant === "outline") && (!disabled),
|
||||
"border-sky-300/80": (variant === "standard" || variant === "outline") && (disabled),
|
||||
"border-cyan-500 hover:border-cyan-500 active:border-cyan-600": (variant === "outline-ghost") && (!disabled),
|
||||
"border-sky-300/80 ": (variant === "outline-ghost") && (disabled)
|
||||
"border-info active:border-info-dark": (variant === "standard" || variant === "outline" || variant === "outline-ghost") && (!disabled),
|
||||
"border-info-light/80": (variant === "standard" || variant === "outline" || variant === "outline-ghost") && (disabled)
|
||||
},
|
||||
//Text
|
||||
{
|
||||
"text-black": variant === "standard",
|
||||
"text-cyan-500 hover:text-cyan-600 active:text-cyan-700": (variant === "outline" || variant === "icon") && (!disabled),
|
||||
"text-sky-300/80": (variant === "outline" || variant === "icon") && (disabled),
|
||||
"text-cyan-500 hover:text-black active:text-black": (variant === "ghost" || variant === "outline-ghost") && (!disabled),
|
||||
"text-sky-300/80 ": (variant === "ghost" || variant === "outline-ghost") && (disabled)
|
||||
"text-info active:text-info-dark": (variant === "outline" || variant === "icon") && (!disabled),
|
||||
"text-info-light/80": (variant === "outline" || variant === "icon" || variant === "ghost" || variant === "outline-ghost") && (disabled),
|
||||
"text-info hover:text-black active:text-black": (variant === "ghost" || variant === "outline-ghost") && (!disabled)
|
||||
}
|
||||
)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
InfoButton.displayName = "InfoButton";
|
||||
|
||||
export default InfoButton;
|
||||
|
||||
Reference in New Issue
Block a user