create-template-html-css 2.0.4 → 2.2.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.
- package/CHANGELOG.md +436 -0
- package/CODE-SPLITTING-GUIDE.md +274 -0
- package/COMPONENTS-GALLERY.html +143 -8
- package/HTML-VS-REACT.md +289 -0
- package/QUICKSTART-REACT.md +293 -0
- package/REACT-SUPPORT-SUMMARY.md +235 -0
- package/README.md +261 -12
- package/bin/cli.js +100 -759
- package/bin/commands/create.js +288 -0
- package/bin/commands/gallery.js +42 -0
- package/bin/commands/insert.js +123 -0
- package/bin/commands/list.js +73 -0
- package/package.json +10 -3
- package/src/component-choices.js +7 -0
- package/src/components-registry.js +112 -0
- package/src/format-utils.js +49 -0
- package/src/generator.js +83 -594
- package/src/generators/color-schemes.js +78 -0
- package/src/generators/color-utils.js +108 -0
- package/src/generators/component-filters.js +151 -0
- package/src/generators/html-generators.js +180 -0
- package/src/generators/validation.js +43 -0
- package/src/index.js +2 -1
- package/src/inserter.js +55 -233
- package/src/inserters/backup-utils.js +20 -0
- package/src/inserters/component-loader.js +68 -0
- package/src/inserters/html-utils.js +31 -0
- package/src/inserters/indentation-utils.js +90 -0
- package/src/inserters/validation-utils.js +49 -0
- package/src/react-component-choices.js +97 -0
- package/src/react-component-templates.js +182 -0
- package/src/react-file-operations.js +172 -0
- package/src/react-generator.js +219 -0
- package/src/react-templates.js +418 -0
- package/src/templates/basic-components-templates.js +157 -0
- package/src/templates/form-components-templates.js +194 -0
- package/src/templates/interactive-components-templates.js +139 -0
- package/src/utils/file-utils.js +97 -0
- package/src/utils/path-utils.js +32 -0
- package/src/utils/string-utils.js +51 -0
- package/src/utils/template-loader.js +91 -0
- package/templates/_shared/PATTERNS.md +246 -0
- package/templates/_shared/README.md +74 -0
- package/templates/_shared/base.css +18 -0
- package/templates/blackjack/index.html +1 -1
- package/templates/breakout/index.html +1 -1
- package/templates/connect-four/index.html +1 -1
- package/templates/dice-game/index.html +1 -1
- package/templates/flappy-bird/index.html +1 -1
- package/templates/pong/index.html +1 -1
- package/templates/skeleton/index.html +4 -4
- package/templates/slot-machine/index.html +1 -1
- package/templates/tetris/index.html +1 -1
- package/templates-react/README.md +126 -0
- package/templates-react/alert/Alert.css +158 -0
- package/templates-react/alert/Alert.example.jsx +106 -0
- package/templates-react/alert/Alert.jsx +61 -0
- package/templates-react/badge/Badge.css +196 -0
- package/templates-react/badge/Badge.example.jsx +182 -0
- package/templates-react/badge/Badge.jsx +44 -0
- package/templates-react/button/Button.css +88 -0
- package/templates-react/button/Button.example.jsx +40 -0
- package/templates-react/button/Button.jsx +29 -0
- package/templates-react/card/Card.css +86 -0
- package/templates-react/card/Card.example.jsx +49 -0
- package/templates-react/card/Card.jsx +35 -0
- package/templates-react/checkbox/Checkbox.css +217 -0
- package/templates-react/checkbox/Checkbox.example.jsx +141 -0
- package/templates-react/checkbox/Checkbox.jsx +82 -0
- package/templates-react/counter/Counter.css +99 -0
- package/templates-react/counter/Counter.example.jsx +45 -0
- package/templates-react/counter/Counter.jsx +70 -0
- package/templates-react/dropdown/Dropdown.css +237 -0
- package/templates-react/dropdown/Dropdown.example.jsx +98 -0
- package/templates-react/dropdown/Dropdown.jsx +154 -0
- package/templates-react/form/Form.css +128 -0
- package/templates-react/form/Form.example.jsx +64 -0
- package/templates-react/form/Form.jsx +125 -0
- package/templates-react/input/Input.css +113 -0
- package/templates-react/input/Input.example.jsx +82 -0
- package/templates-react/input/Input.jsx +87 -0
- package/templates-react/modal/Modal.css +152 -0
- package/templates-react/modal/Modal.example.jsx +90 -0
- package/templates-react/modal/Modal.jsx +46 -0
- package/templates-react/navbar/Navbar.css +139 -0
- package/templates-react/navbar/Navbar.example.jsx +37 -0
- package/templates-react/navbar/Navbar.jsx +62 -0
- package/templates-react/progress/Progress.css +247 -0
- package/templates-react/progress/Progress.example.jsx +244 -0
- package/templates-react/progress/Progress.jsx +79 -0
- package/templates-react/switch/Switch.css +244 -0
- package/templates-react/switch/Switch.example.jsx +221 -0
- package/templates-react/switch/Switch.jsx +98 -0
- package/templates-react/todo-list/TodoList.css +236 -0
- package/templates-react/todo-list/TodoList.example.jsx +15 -0
- package/templates-react/todo-list/TodoList.jsx +84 -0
- package/templates-react/tooltip/Tooltip.css +165 -0
- package/templates-react/tooltip/Tooltip.example.jsx +166 -0
- package/templates-react/tooltip/Tooltip.jsx +176 -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
|
+
}
|
|
@@ -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">
|
|
@@ -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
|