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