Fix what the AI broke
This commit is contained in:
@@ -1,44 +1,31 @@
|
||||
|
||||
|
||||
import type { ButtonProps } from "$/types/ButtonTypes";
|
||||
import clsx from "clsx";
|
||||
import * as React from "react";
|
||||
import { forwardRef } from "react";
|
||||
|
||||
|
||||
|
||||
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
||||
(
|
||||
const Button = forwardRef<HTMLButtonElement, ButtonProps>((
|
||||
{
|
||||
className,
|
||||
type="button",
|
||||
rounding = "lg",
|
||||
shape = "rectangle",
|
||||
size = "md",
|
||||
variant = "standard",
|
||||
disabled,
|
||||
ariaLabel,
|
||||
ariaDescribedBy,
|
||||
ariaControls,
|
||||
role,
|
||||
tabIndex,
|
||||
children,
|
||||
onClick,
|
||||
...buttonProps
|
||||
},
|
||||
ref
|
||||
) => {
|
||||
}, ref ) => {
|
||||
return (
|
||||
<button
|
||||
ref={ref}
|
||||
data-testid="mattrixwv-button"
|
||||
ref={ref}
|
||||
type={type}
|
||||
{...buttonProps}
|
||||
disabled={disabled}
|
||||
aria-label={ariaLabel}
|
||||
aria-describedby={ariaDescribedBy}
|
||||
aria-controls={ariaControls}
|
||||
role={role}
|
||||
tabIndex={tabIndex}
|
||||
className={clsx(
|
||||
className,
|
||||
//Focus
|
||||
"focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",
|
||||
//Rounding
|
||||
{
|
||||
"rounded-sm": rounding === "sm",
|
||||
@@ -67,12 +54,11 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
||||
},
|
||||
//Disabled
|
||||
{
|
||||
"cursor-pointer": !disabled
|
||||
"cursor-pointer": !disabled,
|
||||
"cursor-not-allowed opacity-75": disabled
|
||||
}
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
</button>
|
||||
/>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ButtonHTMLAttributes, Ref } from "react";
|
||||
import type { ButtonHTMLAttributes } from "react";
|
||||
|
||||
|
||||
export type ButtonRounding = "none" | "sm" | "md" | "lg" | "full";
|
||||
@@ -8,15 +8,9 @@ export type ButtonVariant = "standard" | "outline" | "ghost" | "outline-ghost" |
|
||||
|
||||
|
||||
export interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "size" | "type"> {
|
||||
type?: "button" | "submit" | "reset";
|
||||
rounding?: ButtonRounding;
|
||||
shape?: ButtonShape;
|
||||
size?: ButtonSize;
|
||||
variant?: ButtonVariant;
|
||||
ref?: Ref<HTMLButtonElement>;
|
||||
|
||||
ariaLabel?: string;
|
||||
ariaDescribedBy?: string;
|
||||
ariaControls?: string;
|
||||
role?: string;
|
||||
tabIndex?: number;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user