Something went wrong. Try again.
an independent Bluesky client using Constellation, PDS Queries, and other services forked from whey.party/red-dwarf
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960import { Slot } from "@radix-ui/react-slot";import clsx from "clsx";import * as React from "react";
export type ButtonVariant = "filled" | "outlined" | "text" | "secondary";export type ButtonSize = "sm" | "md" | "lg";
const variantClasses: Record<ButtonVariant, string> = { filled: "bg-gray-300 text-gray-900 hover:bg-gray-400 dark:bg-gray-600 dark:text-white dark:hover:bg-gray-500", secondary: "bg-gray-300 text-gray-900 hover:bg-gray-400 dark:bg-gray-600 dark:text-white dark:hover:bg-gray-500", outlined: "border border-gray-800 text-gray-800 hover:bg-gray-100 dark:border-gray-200 dark:text-gray-200 dark:hover:bg-gray-800/10", text: "bg-transparent text-gray-800 hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-gray-800/10",};
const sizeClasses: Record<ButtonSize, string> = { sm: "px-3 py-1.5 text-sm", md: "px-4 py-2 text-base", lg: "px-6 py-3 text-lg",};
export function Button({ variant = "filled", size = "md", asChild = false, ref, className, children, ...props}: { variant?: ButtonVariant; size?: ButtonSize; asChild?: boolean; className?: string; children?: React.ReactNode; ref?: React.Ref<HTMLButtonElement>;} & React.ComponentPropsWithoutRef<"button">) { const Comp = asChild ? Slot : "button";
return ( <Comp ref={ref} className={clsx( //focus:outline-none focus:ring-1 focus:ring-offset-1 focus:ring-gray-500 dark:focus:ring-gray-300 "inline-flex items-center justify-center rounded-full transition-colors disabled:opacity-50 disabled:cursor-not-allowed", variantClasses[variant], sizeClasses[size], className )} {...props} > {children} </Comp> );}
Button.displayName = "Button";