Initial commit
This commit is contained in:
40
skills/frontend-component/examples/Button.tsx
Normal file
40
skills/frontend-component/examples/Button.tsx
Normal file
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Button - Simple button component with variants
|
||||
*
|
||||
* @example
|
||||
* <Button variant="primary" onClick={() => console.log('clicked')}>
|
||||
* Click me
|
||||
* </Button>
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import styles from './Button.module.css';
|
||||
|
||||
interface ButtonProps {
|
||||
children: React.ReactNode;
|
||||
onClick?: () => void;
|
||||
variant?: 'primary' | 'secondary' | 'danger';
|
||||
disabled?: boolean;
|
||||
type?: 'button' | 'submit' | 'reset';
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export const Button: React.FC<ButtonProps> = ({
|
||||
children,
|
||||
onClick,
|
||||
variant = 'primary',
|
||||
disabled = false,
|
||||
type = 'button',
|
||||
className,
|
||||
}) => {
|
||||
return (
|
||||
<button
|
||||
type={type}
|
||||
className={`${styles.button} ${styles[variant]} ${className || ''}`}
|
||||
onClick={onClick}
|
||||
disabled={disabled}
|
||||
>
|
||||
{children}
|
||||
</button>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user