fix: add missing Button UI component for daarion-web build
This commit is contained in:
48
apps/web/src/components/ui/button.tsx
Normal file
48
apps/web/src/components/ui/button.tsx
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import * as React from 'react';
|
||||||
|
|
||||||
|
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
||||||
|
variant?: 'default' | 'outline' | 'ghost' | 'link' | 'destructive';
|
||||||
|
size?: 'default' | 'sm' | 'lg' | 'icon';
|
||||||
|
asChild?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
||||||
|
({ className = '', variant = 'default', size = 'default', children, disabled, ...props }, ref) => {
|
||||||
|
const baseStyles = 'inline-flex items-center justify-center whitespace-nowrap rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50';
|
||||||
|
|
||||||
|
const variantStyles = {
|
||||||
|
default: 'bg-blue-600 text-white hover:bg-blue-700',
|
||||||
|
outline: 'border border-gray-600 bg-transparent hover:bg-gray-800 text-gray-200',
|
||||||
|
ghost: 'hover:bg-gray-800 text-gray-200',
|
||||||
|
link: 'text-blue-400 underline-offset-4 hover:underline',
|
||||||
|
destructive: 'bg-red-600 text-white hover:bg-red-700',
|
||||||
|
};
|
||||||
|
|
||||||
|
const sizeStyles = {
|
||||||
|
default: 'h-10 px-4 py-2 text-sm',
|
||||||
|
sm: 'h-8 px-3 text-xs',
|
||||||
|
lg: 'h-12 px-6 text-base',
|
||||||
|
icon: 'h-10 w-10',
|
||||||
|
};
|
||||||
|
|
||||||
|
const combinedClassName = `${baseStyles} ${variantStyles[variant]} ${sizeStyles[size]} ${className}`;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
ref={ref}
|
||||||
|
className={combinedClassName}
|
||||||
|
disabled={disabled}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
Button.displayName = 'Button';
|
||||||
|
|
||||||
|
export { Button };
|
||||||
|
|
||||||
Reference in New Issue
Block a user