fix: resolve TypeScript errors in migrated components

This commit is contained in:
Jason Woltje
2026-01-29 22:00:14 -06:00
parent d54714ea06
commit abbf886483
36 changed files with 758 additions and 43 deletions

View File

@@ -0,0 +1,26 @@
import { Button as BaseButton } from "@mosaic/ui";
import type { ButtonProps as BaseButtonProps } from "@mosaic/ui";
import type { ReactNode, ButtonHTMLAttributes } from "react";
// Extend Button to support additional variants
type ExtendedVariant = "primary" | "secondary" | "danger" | "ghost" | "outline" | "destructive" | "link";
export interface ButtonProps extends Omit<BaseButtonProps, "variant"> {
variant?: ExtendedVariant;
size?: "sm" | "md" | "lg" | "icon";
children: ReactNode;
}
// Map extended variants to base variants
const variantMap: Record<string, "primary" | "secondary" | "danger" | "ghost"> = {
"outline": "ghost",
"destructive": "danger",
"link": "ghost",
};
export function Button({ variant = "primary", size = "md", ...props }: ButtonProps) {
const mappedVariant = variantMap[variant] || variant;
const mappedSize = size === "icon" ? "sm" : size;
return <BaseButton variant={mappedVariant as "primary" | "secondary" | "danger" | "ghost"} size={mappedSize as "sm" | "md" | "lg"} {...props} />;
}