mirror of
https://github.com/Motion-Games/MotionWebStudio.git
synced 2026-04-21 17:10:54 +02:00
42 lines
1.4 KiB
TypeScript
42 lines
1.4 KiB
TypeScript
import React from 'react';
|
|
|
|
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
variant?: 'primary' | 'secondary' | 'outline' | 'white';
|
|
size?: 'sm' | 'md' | 'lg';
|
|
fullWidth?: boolean;
|
|
}
|
|
|
|
export const Button: React.FC<ButtonProps> = ({
|
|
children,
|
|
variant = 'primary',
|
|
size = 'md',
|
|
fullWidth = false,
|
|
className = '',
|
|
...props
|
|
}) => {
|
|
const baseStyles = "inline-flex items-center justify-center font-semibold transition-all duration-300 rounded-full focus:outline-none focus:ring-2 focus:ring-offset-2";
|
|
|
|
const variants = {
|
|
primary: "bg-gradient-to-r from-primary to-secondary hover:from-primary-dark hover:to-secondary-dark text-white shadow-lg hover:shadow-xl border-transparent focus:ring-primary",
|
|
secondary: "bg-secondary hover:bg-secondary-dark text-white shadow-md focus:ring-secondary",
|
|
outline: "bg-transparent border-2 border-primary text-primary hover:bg-primary hover:text-white focus:ring-primary",
|
|
white: "bg-white text-primary hover:bg-gray-100 shadow-md focus:ring-white"
|
|
};
|
|
|
|
const sizes = {
|
|
sm: "px-4 py-2 text-sm",
|
|
md: "px-6 py-3 text-base",
|
|
lg: "px-8 py-4 text-lg",
|
|
};
|
|
|
|
const widthClass = fullWidth ? "w-full" : "";
|
|
|
|
return (
|
|
<button
|
|
className={`${baseStyles} ${variants[variant]} ${sizes[size]} ${widthClass} ${className}`}
|
|
{...props}
|
|
>
|
|
{children}
|
|
</button>
|
|
);
|
|
}; |