Initial commit for iiEasy: all files included
This commit is contained in:
47
components/Button.tsx
Executable file
47
components/Button.tsx
Executable file
@@ -0,0 +1,47 @@
|
||||
import React from 'react';
|
||||
|
||||
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
||||
variant?: 'primary' | 'outline' | 'secondary';
|
||||
size?: 'sm' | 'md' | 'lg';
|
||||
leftIcon?: React.ReactNode;
|
||||
rightIcon?: React.ReactNode;
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
const Button: React.FC<ButtonProps> = ({
|
||||
variant = 'primary',
|
||||
size = 'md',
|
||||
leftIcon,
|
||||
rightIcon,
|
||||
children,
|
||||
className = '',
|
||||
...props
|
||||
}) => {
|
||||
const baseStyles = "inline-flex items-center justify-center font-medium rounded-full focus:outline-none focus:ring-2 focus:ring-offset-2 transition-all duration-150 ease-in-out font-quicksand disabled:opacity-50 disabled:cursor-not-allowed";
|
||||
|
||||
const sizeStyles = {
|
||||
sm: 'px-3 py-1.5 text-sm',
|
||||
md: 'px-4 py-2 text-base',
|
||||
lg: 'px-6 py-3 text-lg',
|
||||
};
|
||||
|
||||
const variantStyles = {
|
||||
primary: 'text-slate-800 bg-slate-50 hover:bg-slate-100 focus:ring-slate-300 border border-slate-200',
|
||||
outline: 'text-slate-700 border border-slate-300 hover:bg-slate-100 focus:ring-slate-300',
|
||||
secondary: 'text-slate-700 hover:bg-slate-100 focus:ring-slate-300',
|
||||
};
|
||||
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
className={`${baseStyles} ${sizeStyles[size]} ${variantStyles[variant]} ${className}`}
|
||||
{...props}
|
||||
>
|
||||
{leftIcon && <span className="mr-2 -ml-1 h-5 w-5">{leftIcon}</span>}
|
||||
{children}
|
||||
{rightIcon && <span className="ml-2 -mr-1 h-5 w-5">{rightIcon}</span>}
|
||||
</button>
|
||||
);
|
||||
};
|
||||
|
||||
export default Button;
|
||||
Reference in New Issue
Block a user