Files
blitzkit/packages/website-ue/src/components/Button/index.tsx
T

44 lines
910 B
TypeScript
Raw Normal View History

2026-01-09 14:04:59 -06:00
import type { ComponentProps } from "react";
import { classNames } from "../../core/ui/classNames";
2026-01-10 12:43:39 -06:00
import type { Color } from "../../core/ui/color";
2026-01-18 14:12:20 -06:00
import styles from "./index.module.css";
2026-01-09 14:04:59 -06:00
2026-01-10 12:43:39 -06:00
export interface ButtonProps extends ComponentProps<"button"> {
color?: Color;
2026-01-10 13:07:59 -06:00
variant?: "solid";
2026-01-10 12:43:39 -06:00
}
2026-01-09 14:04:59 -06:00
2026-01-17 13:50:53 -06:00
export const LIGHT_TEXT_COLORS = new Set<Color>([
2026-01-10 13:07:59 -06:00
"gold",
"bronze",
"teal",
"grass",
2026-01-17 13:50:53 -06:00
"amber",
2026-01-25 16:13:36 -06:00
"plum",
"pink",
"brown",
"crimson",
"jade",
2026-01-10 13:07:59 -06:00
]);
export function Button({
className,
color,
variant = "solid",
style,
...props
}: ButtonProps) {
return (
<button
2026-01-18 14:12:20 -06:00
className={classNames(styles.button, className)}
2026-01-10 13:07:59 -06:00
data-color={color}
data-variant={variant}
data-light-text={color ? LIGHT_TEXT_COLORS.has(color) : undefined}
style={{
backgroundColor: color ? `var(--${color}-9)` : undefined,
...style,
}}
{...props}
/>
);
2026-01-09 14:04:59 -06:00
}