Files
cydweb/components/ui/button.tsx
DESKTOP-PUHFO60\dsx2016 ae63378fdb Add CYD browser flasher with Next.js, i18n, and Web Serial install.
Replace the starter app with a public/local flasher that discovers sibling firmwares, supports en/zh, and documents HTTPS deploy.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-19 19:38:53 +08:00

52 lines
1.8 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 rounded-full text-sm font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--bg)] disabled:pointer-events-none disabled:opacity-45",
{
variants: {
variant: {
default:
"bg-[linear-gradient(180deg,var(--accent-hot),var(--accent))] text-[var(--accent-ink)] shadow-[0_8px_24px_rgba(240,197,10,0.25)] hover:brightness-105",
ghost:
"rounded-lg border border-[var(--line)] bg-transparent text-[var(--muted)] hover:border-[rgba(240,197,10,0.35)] hover:bg-[rgba(240,197,10,0.06)] hover:text-[var(--ink)]",
outline:
"rounded-lg border border-[var(--line)] bg-transparent text-[var(--ink)] hover:border-[rgba(240,197,10,0.35)]",
},
size: {
default: "h-11 px-6",
sm: "h-8 px-3 text-xs",
lg: "h-12 px-8 text-base",
},
},
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 };