Fix what the AI broke

This commit is contained in:
2026-02-07 13:17:04 -05:00
parent dd052b0557
commit 456feed128
2 changed files with 21 additions and 41 deletions

View File

@@ -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, ...buttonProps
ariaDescribedBy, }, ref ) => {
ariaControls,
role,
tabIndex,
children,
onClick,
...buttonProps
},
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>
); );
} }
); );

View File

@@ -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;
} }