mirror of
https://github.com/jkingsman/Remote-Terminal-for-MeshCore.git
synced 2026-07-02 16:01:21 +02:00
53 lines
2.1 KiB
TypeScript
53 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 whitespace-nowrap text-sm font-medium ring-offset-background transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-40 active:scale-[0.97]',
|
|
{
|
|
variants: {
|
|
variant: {
|
|
default:
|
|
'bg-primary text-primary-foreground hover:bg-primary/90 shadow-glow-amber-sm hover:shadow-glow-amber rounded-lg font-semibold',
|
|
destructive:
|
|
'bg-destructive text-destructive-foreground hover:bg-destructive/90 rounded-lg',
|
|
outline:
|
|
'border border-border bg-transparent hover:bg-secondary hover:border-primary/30 rounded-lg',
|
|
secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80 rounded-lg',
|
|
ghost: 'hover:bg-secondary hover:text-foreground rounded-lg',
|
|
link: 'text-primary underline-offset-4 hover:underline',
|
|
glow: 'bg-gradient-to-r from-amber-500 to-amber-600 text-primary-foreground hover:from-amber-400 hover:to-amber-500 shadow-glow-amber hover:shadow-glow-amber rounded-xl font-semibold',
|
|
},
|
|
size: {
|
|
default: 'h-10 px-5 py-2',
|
|
sm: 'h-8 rounded-lg px-3 text-xs',
|
|
lg: 'h-12 rounded-xl px-8 text-base',
|
|
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 };
|