Files
HaBit/components/ui/button.tsx
Harkamal Randhawa b8596eacee Improve readability and randomize guest landing pet.
Pair Share Tech Mono body text with Press Start 2P display accents, and show a randomized dressed pixel character for signed-out homepage previews.
2026-05-24 05:21:56 -06:00

58 lines
2.1 KiB
TypeScript

import * as React from "react";
import { Slot } from "@radix-ui/react-slot";
import { cva, type VariantProps } from "class-variance-authority";
import { cn } from "@/lib/utils";
const buttonVariants = cva(
"inline-flex items-center justify-center gap-2 whitespace-nowrap border-2 border-border font-pixel text-[10px] font-normal uppercase tracking-wide transition-[transform,box-shadow] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
{
variants: {
variant: {
default:
"bg-primary text-primary-foreground shadow-[var(--retro-shadow-sm)] hover:-translate-x-px hover:-translate-y-px hover:shadow-[3px_3px_0_0_hsl(280_45%_28%)] active:translate-x-0.5 active:translate-y-0.5 active:shadow-none",
destructive:
"bg-destructive text-destructive-foreground shadow-[var(--retro-shadow-sm)]",
outline:
"border-border bg-background shadow-[var(--retro-shadow-sm)] hover:bg-muted hover:text-foreground",
secondary:
"bg-secondary text-secondary-foreground shadow-[var(--retro-shadow-sm)]",
ghost: "border-transparent shadow-none hover:bg-muted hover:text-foreground",
link: "border-transparent text-secondary underline-offset-4 shadow-none hover:underline",
},
size: {
default: "h-10 px-4 py-2",
sm: "h-8 px-3 text-[10px]",
lg: "h-11 px-8",
icon: "h-10 w-10",
},
},
defaultVariants: {
variant: "default",
size: "default",
},
},
);
export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> {
asChild?: boolean;
}
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "button";
return (
<Comp
className={cn(buttonVariants({ variant, size, className }))}
ref={ref}
{...props}
/>
);
},
);
Button.displayName = "Button";
export { Button, buttonVariants };