create-template-html-css 2.0.4 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/CHANGELOG.md +305 -0
  2. package/HTML-VS-REACT.md +289 -0
  3. package/QUICKSTART-REACT.md +293 -0
  4. package/REACT-SUPPORT-SUMMARY.md +235 -0
  5. package/README.md +193 -12
  6. package/bin/cli.js +98 -759
  7. package/bin/commands/create.js +272 -0
  8. package/bin/commands/gallery.js +42 -0
  9. package/bin/commands/insert.js +123 -0
  10. package/bin/commands/list.js +73 -0
  11. package/package.json +10 -3
  12. package/src/component-choices.js +7 -0
  13. package/src/components-registry.js +112 -0
  14. package/src/format-utils.js +49 -0
  15. package/src/generator.js +83 -594
  16. package/src/generators/color-schemes.js +78 -0
  17. package/src/generators/color-utils.js +108 -0
  18. package/src/generators/component-filters.js +151 -0
  19. package/src/generators/html-generators.js +180 -0
  20. package/src/generators/validation.js +43 -0
  21. package/src/index.js +2 -1
  22. package/src/inserter.js +55 -233
  23. package/src/inserters/backup-utils.js +20 -0
  24. package/src/inserters/component-loader.js +68 -0
  25. package/src/inserters/html-utils.js +31 -0
  26. package/src/inserters/indentation-utils.js +90 -0
  27. package/src/inserters/validation-utils.js +49 -0
  28. package/src/react-component-choices.js +45 -0
  29. package/src/react-file-operations.js +172 -0
  30. package/src/react-generator.js +208 -0
  31. package/src/react-templates.js +350 -0
  32. package/src/utils/file-utils.js +97 -0
  33. package/src/utils/path-utils.js +32 -0
  34. package/src/utils/string-utils.js +51 -0
  35. package/src/utils/template-loader.js +91 -0
  36. package/templates/_shared/PATTERNS.md +246 -0
  37. package/templates/_shared/README.md +74 -0
  38. package/templates/_shared/base.css +18 -0
  39. package/templates/blackjack/index.html +1 -1
  40. package/templates/breakout/index.html +1 -1
  41. package/templates/connect-four/index.html +1 -1
  42. package/templates/dice-game/index.html +1 -1
  43. package/templates/flappy-bird/index.html +1 -1
  44. package/templates/pong/index.html +1 -1
  45. package/templates/skeleton/index.html +4 -4
  46. package/templates/slot-machine/index.html +1 -1
  47. package/templates/tetris/index.html +1 -1
  48. package/templates-react/README.md +126 -0
  49. package/templates-react/button/Button.css +88 -0
  50. package/templates-react/button/Button.example.jsx +40 -0
  51. package/templates-react/button/Button.jsx +29 -0
  52. package/templates-react/card/Card.css +86 -0
  53. package/templates-react/card/Card.example.jsx +49 -0
  54. package/templates-react/card/Card.jsx +35 -0
  55. package/templates-react/counter/Counter.css +99 -0
  56. package/templates-react/counter/Counter.example.jsx +45 -0
  57. package/templates-react/counter/Counter.jsx +70 -0
  58. package/templates-react/form/Form.css +128 -0
  59. package/templates-react/form/Form.example.jsx +65 -0
  60. package/templates-react/form/Form.jsx +125 -0
  61. package/templates-react/modal/Modal.css +152 -0
  62. package/templates-react/modal/Modal.example.jsx +90 -0
  63. package/templates-react/modal/Modal.jsx +46 -0
  64. package/templates-react/todo-list/TodoList.css +236 -0
  65. package/templates-react/todo-list/TodoList.example.jsx +15 -0
  66. package/templates-react/todo-list/TodoList.jsx +84 -0
@@ -0,0 +1,246 @@
1
+ # Template Code Patterns
2
+
3
+ This document catalogs common code patterns found across templates. These patterns are intentionally duplicated in each template to maintain independence.
4
+
5
+ ## JavaScript Patterns
6
+
7
+ ### DOM Selection Patterns
8
+
9
+ **querySelector/querySelectorAll** - Used in 40+ templates
10
+ ```javascript
11
+ const element = document.querySelector('.class-name');
12
+ const elements = document.querySelectorAll('.multiple-items');
13
+ ```
14
+
15
+ **getElementById** - Used in 35+ templates (especially games and interactive components)
16
+ ```javascript
17
+ const button = document.getElementById('myButton');
18
+ ```
19
+
20
+ ### Event Listener Patterns
21
+
22
+ **Click Handlers** - Found in all interactive templates
23
+ ```javascript
24
+ button.addEventListener('click', handleClick);
25
+
26
+ // Or inline
27
+ button.addEventListener('click', () => {
28
+ // Handle click
29
+ });
30
+ ```
31
+
32
+ **Common Event Setup**
33
+ ```javascript
34
+ // Multiple elements
35
+ buttons.forEach(button => {
36
+ button.addEventListener('click', handler);
37
+ });
38
+
39
+ // Delegation pattern
40
+ document.addEventListener('click', function(e) {
41
+ if (e.target.matches('.selector')) {
42
+ // Handle
43
+ }
44
+ });
45
+ ```
46
+
47
+ ### Game Control Patterns
48
+
49
+ Found in 12 game templates (snake, tetris, pong, etc.):
50
+ ```javascript
51
+ let gameActive = false;
52
+ let score = 0;
53
+
54
+ function startGame() {
55
+ gameActive = true;
56
+ score = 0;
57
+ // Initialize game
58
+ }
59
+
60
+ function pauseGame() {
61
+ gameActive = false;
62
+ // Pause logic
63
+ }
64
+
65
+ function resetGame() {
66
+ gameActive = false;
67
+ score = 0;
68
+ // Reset logic
69
+ }
70
+
71
+ // Button bindings
72
+ startBtn.addEventListener('click', startGame);
73
+ pauseBtn.addEventListener('click', pauseGame);
74
+ resetBtn.addEventListener('click', resetGame);
75
+ ```
76
+
77
+ ### Update Display Pattern
78
+
79
+ Common in counters, scores, and dynamic content:
80
+ ```javascript
81
+ function updateDisplay() {
82
+ element.textContent = value;
83
+ // Update other UI elements
84
+ }
85
+ ```
86
+
87
+ ## CSS Patterns
88
+
89
+ ### Layout Patterns
90
+
91
+ **Centered Container** (30+ templates)
92
+ ```css
93
+ body {
94
+ display: flex;
95
+ justify-content: center;
96
+ align-items: center;
97
+ min-height: 100vh;
98
+ }
99
+
100
+ .container {
101
+ background: white;
102
+ padding: 40px;
103
+ border-radius: 15px;
104
+ box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
105
+ }
106
+ ```
107
+
108
+ **Grid Layout** (15+ templates)
109
+ ```css
110
+ .grid {
111
+ display: grid;
112
+ grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
113
+ gap: 20px;
114
+ }
115
+ ```
116
+
117
+ **Flexbox Layout** (20+ templates)
118
+ ```css
119
+ .flex-container {
120
+ display: flex;
121
+ gap: 15px;
122
+ flex-wrap: wrap;
123
+ }
124
+ ```
125
+
126
+ ### Animation Patterns
127
+
128
+ **Hover Transitions** (35+ templates)
129
+ ```css
130
+ .element {
131
+ transition: all 0.3s ease;
132
+ }
133
+
134
+ .element:hover {
135
+ transform: translateY(-5px);
136
+ box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
137
+ }
138
+ ```
139
+
140
+ **Fade Animations**
141
+ ```css
142
+ @keyframes fadeIn {
143
+ from { opacity: 0; }
144
+ to { opacity: 1; }
145
+ }
146
+
147
+ .animated {
148
+ animation: fadeIn 0.5s ease-in-out;
149
+ }
150
+ ```
151
+
152
+ ### Button Patterns
153
+
154
+ Found in 40+ templates:
155
+ ```css
156
+ .btn {
157
+ padding: 12px 24px;
158
+ border: none;
159
+ border-radius: 8px;
160
+ cursor: pointer;
161
+ font-size: 16px;
162
+ transition: all 0.3s ease;
163
+ }
164
+
165
+ .btn:hover {
166
+ transform: translateY(-2px);
167
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
168
+ }
169
+
170
+ .btn:active {
171
+ transform: translateY(0);
172
+ }
173
+ ```
174
+
175
+ ## HTML Patterns
176
+
177
+ ### Semantic Structure
178
+
179
+ **Container → Card → Content** (25+ templates)
180
+ ```html
181
+ <div class="container">
182
+ <div class="card">
183
+ <h1>Title</h1>
184
+ <p>Content</p>
185
+ </div>
186
+ </div>
187
+ ```
188
+
189
+ **Form Structure** (form, login, register templates)
190
+ ```html
191
+ <form class="form">
192
+ <h1 class="form-title">Title</h1>
193
+ <div class="form-group">
194
+ <label for="input">Label</label>
195
+ <input type="text" id="input" name="input">
196
+ </div>
197
+ <button type="submit">Submit</button>
198
+ </form>
199
+ ```
200
+
201
+ ### Canvas for Games (10 game templates)
202
+ ```html
203
+ <canvas id="gameCanvas" width="400" height="400"></canvas>
204
+ <div class="game-controls">
205
+ <button id="startBtn">Start</button>
206
+ <button id="pauseBtn">Pause</button>
207
+ <button id="resetBtn">Reset</button>
208
+ </div>
209
+ ```
210
+
211
+ ## Why These Patterns Repeat
212
+
213
+ 1. **Consistency**: Users recognize familiar patterns across templates
214
+ 2. **Learning**: Patterns reinforce best practices
215
+ 3. **Copy-Paste Ready**: Each template works standalone
216
+ 4. **No Dependencies**: No shared libraries to break
217
+
218
+ ## Best Practices for New Templates
219
+
220
+ When creating new templates, follow these patterns:
221
+
222
+ ✅ **DO**:
223
+ - Use semantic HTML5 elements
224
+ - Include comprehensive comments
225
+ - Follow existing naming conventions
226
+ - Keep JavaScript vanilla (no frameworks)
227
+ - Make it work without any build process
228
+
229
+ ❌ **DON'T**:
230
+ - Import from other templates
231
+ - Require external libraries (unless clearly documented)
232
+ - Use complex build tools
233
+ - Break the self-contained principle
234
+
235
+ ## Statistics
236
+
237
+ - **Total Templates**: 42
238
+ - **JavaScript Files**: 42
239
+ - **CSS Files**: 42
240
+ - **HTML Files**: 42
241
+ - **Average File Size**: ~150 lines per file
242
+ - **Common Patterns**: 15+ recurring patterns across templates
243
+
244
+ ---
245
+
246
+ *These patterns ensure consistency while maintaining template independence.*
@@ -0,0 +1,74 @@
1
+ # Shared Template Resources
2
+
3
+ This directory contains shared resources and documentation for templates.
4
+
5
+ ## Philosophy: Self-Contained Templates
6
+
7
+ **Each template is intentionally self-contained and standalone.** This means:
8
+ - ✅ Every template includes its own complete HTML, CSS, and JS
9
+ - ✅ No external dependencies between templates
10
+ - ✅ Users can copy a single template folder and it "just works"
11
+ - ✅ Perfect for learning, prototyping, and quick integration
12
+
13
+ ## Why Not Use Shared CSS?
14
+
15
+ While we have `base.css` with common styles, **we deliberately duplicate** them in each template because:
16
+
17
+ 1. **Portability**: Users can grab one folder and go
18
+ 2. **Independence**: No broken links if files are moved
19
+ 3. **Customization**: Users can modify without affecting others
20
+ 4. **Simplicity**: No build process or import management needed
21
+
22
+ ## Common Patterns (For Reference)
23
+
24
+ ### CSS Reset (42/42 templates)
25
+ ```css
26
+ * {
27
+ margin: 0;
28
+ padding: 0;
29
+ box-sizing: border-box;
30
+ }
31
+ ```
32
+
33
+ ### Gradient Body (37/42 templates)
34
+ ```css
35
+ body {
36
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
37
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
38
+ min-height: 100vh;
39
+ }
40
+ ```
41
+
42
+ ### Common Container Pattern
43
+ ```css
44
+ .container {
45
+ background: white;
46
+ padding: 40px;
47
+ border-radius: 15px;
48
+ box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
49
+ }
50
+ ```
51
+
52
+ ## Files
53
+
54
+ ### base.css
55
+ Reference implementation of common CSS patterns. Use this as a template when creating new components.
56
+
57
+ ## Creating New Templates
58
+
59
+ When adding new templates:
60
+ 1. Copy the full CSS reset and base styles (don't import)
61
+ 2. Follow existing naming conventions
62
+ 3. Keep it self-contained
63
+ 4. Test that the folder works in isolation
64
+
65
+ ## Statistics
66
+
67
+ - **Total Templates**: 42
68
+ - **Templates with CSS Reset**: 42 (100%)
69
+ - **Templates with Gradient Background**: 37 (88%)
70
+ - **Duplication is intentional** for better user experience
71
+
72
+ ---
73
+
74
+ *Note: This duplication is a feature, not a bug. It optimizes for end-user experience over DRY principles.*
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Shared CSS Reset and Base Styles
3
+ * This file contains common styles used across all templates
4
+ */
5
+
6
+ /* CSS Reset */
7
+ * {
8
+ margin: 0;
9
+ padding: 0;
10
+ box-sizing: border-box;
11
+ }
12
+
13
+ /* Base Body Styles - Common gradient background and font */
14
+ body {
15
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
16
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
17
+ min-height: 100vh;
18
+ }
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Blackjack - 21</title>
6
+ <title>{{name}} - Blackjack Game</title>
7
7
  <link rel="stylesheet" href="style.css">
8
8
  </head>
9
9
  <body>
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Breakout</title>
6
+ <title>{{name}} - Breakout Game</title>
7
7
  <link rel="stylesheet" href="style.css">
8
8
  </head>
9
9
  <body>
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Connect Four</title>
6
+ <title>{{name}} - Connect Four Game</title>
7
7
  <link rel="stylesheet" href="style.css">
8
8
  </head>
9
9
  <body>
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Dice Game</title>
6
+ <title>{{name}} - Dice Game</title>
7
7
  <link rel="stylesheet" href="style.css">
8
8
  </head>
9
9
  <body>
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Flappy Bird</title>
6
+ <title>{{name}} - Flappy Bird Game</title>
7
7
  <link rel="stylesheet" href="style.css">
8
8
  </head>
9
9
  <body>
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Pong</title>
6
+ <title>{{name}} - Pong Game</title>
7
7
  <link rel="stylesheet" href="style.css">
8
8
  </head>
9
9
  <body>
@@ -1,10 +1,10 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en">
3
3
  <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Skeleton Loading</title>
7
- <link rel="stylesheet" href="style.css" />
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>{{name}} - Skeleton Loading</title>
7
+ <link rel="stylesheet" href="style.css">
8
8
  </head>
9
9
  <body>
10
10
  <div class="skeleton-container">
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Slot Machine</title>
6
+ <title>{{name}} - Slot Machine Game</title>
7
7
  <link rel="stylesheet" href="style.css">
8
8
  </head>
9
9
  <body>
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Tetris</title>
6
+ <title>{{name}} - Tetris Game</title>
7
7
  <link rel="stylesheet" href="style.css">
8
8
  </head>
9
9
  <body>
@@ -0,0 +1,126 @@
1
+ # React Components Templates 🎨⚛️
2
+
3
+ This directory contains React component templates that can be generated using the `create-template` CLI tool with React support.
4
+
5
+ ## Available Components
6
+
7
+ ### 🔘 Button
8
+ A customizable button component with various styles and states:
9
+ - **Variants**: primary, secondary, success, danger
10
+ - **Sizes**: small, medium, large
11
+ - **States**: enabled, disabled
12
+ - **Props**: variant, size, disabled, onClick, type, className
13
+
14
+ ### 🎴 Card
15
+ A versatile card component for displaying content:
16
+ - **Features**: image support, title, description, footer
17
+ - **Responsive design**
18
+ - **Hover effects**
19
+ - **Dark mode support**
20
+ - **Props**: title, description, image, imageAlt, footer, onClick, className
21
+
22
+ ### 🔢 Counter
23
+ A simple counter with increment and decrement functionality:
24
+ - **Features**: customizable initial value, min/max limits, custom step
25
+ - **Animations**: smooth transitions
26
+ - **Controls**: increment, decrement, reset buttons
27
+ - **Props**: initialValue, min, max, step, onChange
28
+
29
+ ### 📝 Form
30
+ A flexible form component with validation:
31
+ - **Features**: multiple field types (text, email, textarea, select)
32
+ - **Validation**: required fields, patterns, min length
33
+ - **Error messages**
34
+ - **Dark mode support**
35
+ - **Props**: title, fields, onSubmit, submitButtonText
36
+
37
+ ### 🪟 Modal
38
+ A flexible modal dialog component:
39
+ - **Features**: overlay click to close, customizable size
40
+ - **Sizes**: small, medium, large
41
+ - **Animations**: fade in, slide up
42
+ - **Dark mode support**
43
+ - **Props**: isOpen, onClose, title, children, footer, showCloseButton, closeOnOverlayClick, size
44
+
45
+ ### ✅ Todo List
46
+ A complete todo list with add, toggle, and delete functionality:
47
+ - **Features**: add tasks, mark as complete, delete tasks
48
+ - **Statistics**: active and completed count
49
+ - **Animations**: smooth transitions
50
+ - **Dark mode support**
51
+ - **Local state management**
52
+
53
+ ## Usage
54
+
55
+ ### Creating a React Component
56
+
57
+ ```bash
58
+ # Interactive mode
59
+ npx create-template-html-css create --react
60
+
61
+ # With flags
62
+ npx create-template-html-css create --react --component button --name my-button
63
+ ```
64
+
65
+ ### Importing in Your Project
66
+
67
+ ```jsx
68
+ import Button from './components/Button/Button';
69
+ import './components/Button/Button.css';
70
+
71
+ function App() {
72
+ return (
73
+ <Button variant="primary" onClick={() => console.log('Clicked!')}>
74
+ Click Me
75
+ </Button>
76
+ );
77
+ }
78
+ ```
79
+
80
+ ## Component Structure
81
+
82
+ Each component follows this structure:
83
+ ```
84
+ component-name/
85
+ ├── ComponentName.jsx # Main component
86
+ ├── ComponentName.css # Styles
87
+ └── ComponentName.example.jsx # Usage examples
88
+ ```
89
+
90
+ ## Styling
91
+
92
+ All components support:
93
+ - ✨ Gradient backgrounds with customizable colors
94
+ - 🌙 Dark mode (prefers-color-scheme)
95
+ - 📱 Responsive design
96
+ - 🎭 Smooth animations and transitions
97
+ - 🎨 CSS color placeholders ({{primaryColor}}, {{secondaryColor}})
98
+
99
+ ## Color Customization
100
+
101
+ Colors can be customized during generation:
102
+ - `--primary-color`: Main brand color
103
+ - `--secondary-color`: Accent color
104
+ - `--color-scheme`: Predefined schemes (ocean, sunset, forest, etc.)
105
+
106
+ ## Requirements
107
+
108
+ These components are designed for use with:
109
+ - React 16.8+ (Hooks support)
110
+ - Modern browsers (ES6+)
111
+ - CSS3 support
112
+
113
+ ## Contributing
114
+
115
+ To add a new React component template:
116
+ 1. Create a new directory in `templates-react/`
117
+ 2. Add `ComponentName.jsx`, `ComponentName.css`, and `ComponentName.example.jsx`
118
+ 3. Follow the existing component structure
119
+ 4. Update this README
120
+
121
+ ## Notes
122
+
123
+ - All components use functional components with hooks
124
+ - PropTypes or TypeScript types can be added as needed
125
+ - Components are fully self-contained with their own styles
126
+ - CSS uses placeholders for color customization during generation
@@ -0,0 +1,88 @@
1
+ /* Button Styles */
2
+ .btn {
3
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
4
+ font-weight: 600;
5
+ border: none;
6
+ border-radius: 8px;
7
+ cursor: pointer;
8
+ transition: all 0.3s ease;
9
+ outline: none;
10
+ display: inline-flex;
11
+ align-items: center;
12
+ justify-content: center;
13
+ gap: 8px;
14
+ }
15
+
16
+ /* Size Variations */
17
+ .btn-small {
18
+ padding: 8px 16px;
19
+ font-size: 14px;
20
+ }
21
+
22
+ .btn-medium {
23
+ padding: 12px 24px;
24
+ font-size: 16px;
25
+ }
26
+
27
+ .btn-large {
28
+ padding: 16px 32px;
29
+ font-size: 18px;
30
+ }
31
+
32
+ /* Variant Styles - Primary */
33
+ .btn-primary {
34
+ background: linear-gradient(135deg, {{primaryColor}} 0%, {{secondaryColor}} 100%);
35
+ color: white;
36
+ box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
37
+ }
38
+
39
+ .btn-primary:hover:not(:disabled) {
40
+ transform: translateY(-2px);
41
+ box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
42
+ }
43
+
44
+ .btn-primary:active:not(:disabled) {
45
+ transform: translateY(0);
46
+ }
47
+
48
+ /* Variant Styles - Secondary */
49
+ .btn-secondary {
50
+ background: transparent;
51
+ color: {{primaryColor}};
52
+ border: 2px solid {{primaryColor}};
53
+ }
54
+
55
+ .btn-secondary:hover:not(:disabled) {
56
+ background: {{primaryColor}};
57
+ color: white;
58
+ }
59
+
60
+ /* Variant Styles - Danger */
61
+ .btn-danger {
62
+ background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
63
+ color: white;
64
+ box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
65
+ }
66
+
67
+ .btn-danger:hover:not(:disabled) {
68
+ transform: translateY(-2px);
69
+ box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
70
+ }
71
+
72
+ /* Variant Styles - Success */
73
+ .btn-success {
74
+ background: linear-gradient(135deg, #51cf66 0%, #37b24d 100%);
75
+ color: white;
76
+ box-shadow: 0 4px 15px rgba(81, 207, 102, 0.3);
77
+ }
78
+
79
+ .btn-success:hover:not(:disabled) {
80
+ transform: translateY(-2px);
81
+ box-shadow: 0 6px 20px rgba(81, 207, 102, 0.4);
82
+ }
83
+
84
+ /* Disabled State */
85
+ .btn:disabled {
86
+ opacity: 0.5;
87
+ cursor: not-allowed;
88
+ }
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+ import Button from './Button';
3
+
4
+ /**
5
+ * Example usage of Button component
6
+ */
7
+ const ButtonExample = () => {
8
+ const handleClick = () => {
9
+ console.log('Button clicked!');
10
+ };
11
+
12
+ return (
13
+ <div style={{ padding: '40px', display: 'flex', flexDirection: 'column', gap: '20px' }}>
14
+ <h2>Button Component Examples</h2>
15
+
16
+ <div style={{ display: 'flex', gap: '10px', flexWrap: 'wrap' }}>
17
+ <h3 style={{ width: '100%' }}>Variants</h3>
18
+ <Button variant="primary" onClick={handleClick}>Primary Button</Button>
19
+ <Button variant="secondary" onClick={handleClick}>Secondary Button</Button>
20
+ <Button variant="success" onClick={handleClick}>Success Button</Button>
21
+ <Button variant="danger" onClick={handleClick}>Danger Button</Button>
22
+ </div>
23
+
24
+ <div style={{ display: 'flex', gap: '10px', flexWrap: 'wrap' }}>
25
+ <h3 style={{ width: '100%' }}>Sizes</h3>
26
+ <Button size="small" onClick={handleClick}>Small</Button>
27
+ <Button size="medium" onClick={handleClick}>Medium</Button>
28
+ <Button size="large" onClick={handleClick}>Large</Button>
29
+ </div>
30
+
31
+ <div style={{ display: 'flex', gap: '10px', flexWrap: 'wrap' }}>
32
+ <h3 style={{ width: '100%' }}>States</h3>
33
+ <Button onClick={handleClick}>Enabled</Button>
34
+ <Button disabled>Disabled</Button>
35
+ </div>
36
+ </div>
37
+ );
38
+ };
39
+
40
+ export default ButtonExample;