import type { ButtonProps } from "$/types/ButtonTypes";
import clsx from "clsx";
import { forwardRef } from "react";
import Button from "./Button";


const DarkButton = forwardRef<HTMLButtonElement, ButtonProps>(({
	className,
	variant = "standard",
	disabled,
	...buttonProps
}, ref) => {
	return (
		<Button
			data-testid="mattrixwv-dark-button"
			{...buttonProps}
			ref={ref}
			variant={variant}
			disabled={disabled}
			className={clsx(
				"transition duration-300",
				className,
				//Background
				{
					"bg-dark active:bg-dark-mid": (variant === "standard") && (!disabled),
					"bg-dark-mid/80": (variant === "standard") && (disabled),
					"bg-transparent": (variant === "outline" || variant === "icon"),
					"bg-transparent hover:bg-dark active:bg-dark-mid": (variant === "ghost" || variant === "outline-ghost") && (!disabled),
					"bg-transparent ": (variant === "ghost" || variant === "outline-ghost") && (disabled)
				},
				//Outline
				{
					"border-dark active:border-dark-mid": (variant === "standard" || variant === "outline" || variant === "outline-ghost") && (!disabled),
					"border-dark-mid/80": (variant === "standard" || variant === "outline" || variant === "outline-ghost") && (disabled)
				},
				//Text
				{
					"text-white": variant === "standard",
					"text-dark active:text-dark-mid": (variant === "outline" || variant === "icon") && (!disabled),
					"text-dark-mid/80": (variant === "outline" || variant === "icon" || variant === "ghost" || variant === "outline-ghost") && (disabled),
					"text-dark hover:text-white active:text-white": (variant === "ghost" || variant === "outline-ghost") && (!disabled)
				}
			)}
		/>
	);
});

DarkButton.displayName = "DarkButton";

export default DarkButton;
