Skip to content

Commit 85565c7

Browse files
committed
intiial commit
1 parent d093804 commit 85565c7

File tree

3 files changed

+277
-40
lines changed

3 files changed

+277
-40
lines changed

package-lock.json

+74-31
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/button/Button.tsx

+28-4
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,43 @@ import './button.css';
33

44
/** Primary UI component for user interaction */
55
export interface ButtonProps {
6-
primary?: boolean;
6+
mode: 'light' | 'dark',
7+
variant?: 'primary' | 'secondary',
8+
danger?: boolean,
9+
desktop?: boolean,
710
backgroundColor?: string;
811
size?: 'small' | 'medium' | 'large';
912
label: string;
1013
onClick?: () => void;
1114
}
1215

13-
export const Button: React.FC<ButtonProps> = ({ primary = false, backgroundColor, size = 'medium', label, ...props }) => {
14-
const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
16+
export const Button: React.FC<ButtonProps> = ({
17+
mode = 'light',
18+
variant = 'primary',
19+
backgroundColor,
20+
size = 'medium',
21+
label,
22+
desktop = true,
23+
danger = false,
24+
...props }) => {
25+
// Main mode: light or dark
26+
const modeClass = mode === 'dark' ? 'storybook-button--dark' : 'storybook-button--light';
27+
28+
// Variant: primary or secondary
29+
const variantClass = variant === 'primary' ? 'storybook-button--primary' : 'storybook-button--secondary';
30+
31+
// Danger state: danger or no danger
32+
const dangerClass = danger ? 'storybook-button--danger' : '';
33+
34+
// Device type: desktop or mobile
35+
const deviceClass = desktop ? 'storybook-button--desktop' : 'storybook-button--mobile';
36+
37+
// Size: small, medium, or large
38+
const sizeClass = `storybook-button--${size}`;
1539
return (
1640
<button
1741
type="button"
18-
className={['storybook-button', `storybook-button--${size}`, mode].join(' ')}
42+
className={['storybook-button', deviceClass, sizeClass, dangerClass, variantClass, modeClass].join(' ')}
1943
style={backgroundColor ? { backgroundColor } : undefined}
2044
{...props}
2145
>

0 commit comments

Comments
 (0)