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
package/HTML-VS-REACT.md
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
# HTML vs React - Which Should You Choose? 🤔
|
|
2
|
+
|
|
3
|
+
This guide helps you decide whether to use HTML/CSS/JS templates or React components.
|
|
4
|
+
|
|
5
|
+
## Quick Decision Tree
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Do you need a static website or simple interactive page?
|
|
9
|
+
├─ Yes → Use HTML/CSS/JS templates ✅
|
|
10
|
+
└─ No → Continue
|
|
11
|
+
|
|
12
|
+
Are you building a complex single-page application (SPA)?
|
|
13
|
+
├─ Yes → Use React components ⚛️
|
|
14
|
+
└─ No → Continue
|
|
15
|
+
|
|
16
|
+
Do you need component reusability and state management?
|
|
17
|
+
├─ Yes → Use React components ⚛️
|
|
18
|
+
└─ No → Use HTML/CSS/JS templates ✅
|
|
19
|
+
|
|
20
|
+
Do you already have a React project?
|
|
21
|
+
├─ Yes → Use React components ⚛️
|
|
22
|
+
└─ No → Use HTML/CSS/JS templates ✅
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## HTML/CSS/JS Templates
|
|
26
|
+
|
|
27
|
+
### ✅ Use When:
|
|
28
|
+
|
|
29
|
+
- **Static Websites**: Landing pages, portfolios, blogs
|
|
30
|
+
- **Simple Projects**: Small interactive pages without complex state
|
|
31
|
+
- **Learning**: You're learning web development basics
|
|
32
|
+
- **No Build Tools**: You want to avoid npm, webpack, vite, etc.
|
|
33
|
+
- **Quick Prototypes**: Fast mockups and demos
|
|
34
|
+
- **Direct Integration**: Adding to existing plain HTML projects
|
|
35
|
+
- **SEO Priority**: Need server-side rendering without complexity
|
|
36
|
+
|
|
37
|
+
### 📦 What You Get:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
my-component/
|
|
41
|
+
├── index.html # Ready to open in browser
|
|
42
|
+
├── css/
|
|
43
|
+
│ └── style.css # Styled and ready
|
|
44
|
+
└── js/
|
|
45
|
+
└── script.js # Vanilla JavaScript
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 🚀 Usage:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
create-template create -c button -n my-button
|
|
52
|
+
cd my-button
|
|
53
|
+
# Just open index.html in browser - no build step!
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Example Use Cases:
|
|
57
|
+
|
|
58
|
+
1. **Portfolio Website**: Use navigation, hero, footer templates
|
|
59
|
+
2. **Landing Page**: Use hero, form, card templates
|
|
60
|
+
3. **Documentation Site**: Use navigation, tabs, accordion
|
|
61
|
+
4. **Business Website**: Use navigation, footer, form, card
|
|
62
|
+
5. **Game Projects**: Use 16 interactive game templates
|
|
63
|
+
6. **Prototyping**: Quick component mockups
|
|
64
|
+
|
|
65
|
+
## React Components
|
|
66
|
+
|
|
67
|
+
### ⚛️ Use When:
|
|
68
|
+
|
|
69
|
+
- **Single Page Applications (SPAs)**: Complex interactive apps
|
|
70
|
+
- **Component Reusability**: Need to use components multiple times
|
|
71
|
+
- **State Management**: Complex data flows and state updates
|
|
72
|
+
- **Modern Workflow**: Already using npm and build tools
|
|
73
|
+
- **React Projects**: Integrating into existing React apps
|
|
74
|
+
- **Team Collaboration**: Working with React-focused teams
|
|
75
|
+
- **Scalability**: Building large applications
|
|
76
|
+
|
|
77
|
+
### 📦 What You Get:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
my-component/
|
|
81
|
+
├── src/
|
|
82
|
+
│ ├── components/
|
|
83
|
+
│ │ └── Button/
|
|
84
|
+
│ │ ├── Button.jsx
|
|
85
|
+
│ │ └── Button.css
|
|
86
|
+
│ ├── App.jsx
|
|
87
|
+
│ └── index.js
|
|
88
|
+
├── package.json
|
|
89
|
+
├── vite.config.js
|
|
90
|
+
└── index.html
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### 🚀 Usage:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
create-template create --react -c button -n my-button
|
|
97
|
+
cd my-button
|
|
98
|
+
npm install
|
|
99
|
+
npm run dev
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Example Use Cases:
|
|
103
|
+
|
|
104
|
+
1. **Dashboard Application**: Use counter, card, modal
|
|
105
|
+
2. **Todo Application**: Use todo-list component
|
|
106
|
+
3. **Form-Heavy Apps**: Use form component with validation
|
|
107
|
+
4. **Admin Panels**: Use button, card, modal, form
|
|
108
|
+
5. **Interactive UI**: Components with complex state
|
|
109
|
+
6. **Component Libraries**: Building reusable component sets
|
|
110
|
+
|
|
111
|
+
## Feature Comparison
|
|
112
|
+
|
|
113
|
+
| Feature | HTML/CSS/JS | React |
|
|
114
|
+
|---------|-------------|-------|
|
|
115
|
+
| **Setup Time** | Instant | 2-3 minutes (npm install) |
|
|
116
|
+
| **Learning Curve** | Beginner-friendly | Requires React knowledge |
|
|
117
|
+
| **Build Tools** | None required | Vite (fast modern build) |
|
|
118
|
+
| **File Size** | Smaller | Larger (includes React) |
|
|
119
|
+
| **State Management** | Manual DOM | React hooks |
|
|
120
|
+
| **SEO** | Excellent | Requires SSR/SSG |
|
|
121
|
+
| **Browser Support** | All browsers | Modern browsers |
|
|
122
|
+
| **Hot Reload** | Manual refresh | Automatic (HMR) |
|
|
123
|
+
| **Component Reuse** | Copy/paste HTML | Import/export |
|
|
124
|
+
| **TypeScript** | Not included | Easy to add |
|
|
125
|
+
| **Testing** | Manual | Jest/Testing Library |
|
|
126
|
+
| **Available Components** | 46 templates | 6 components |
|
|
127
|
+
|
|
128
|
+
## Available Templates/Components
|
|
129
|
+
|
|
130
|
+
### HTML Templates (46)
|
|
131
|
+
|
|
132
|
+
**UI Components:**
|
|
133
|
+
- button, card, form, navigation, modal, footer, hero
|
|
134
|
+
- slider, table, login, register, skeleton, spinner
|
|
135
|
+
- animated-card, typing-effect, fade-gallery
|
|
136
|
+
- accordion, tabs, todo-list, counter
|
|
137
|
+
|
|
138
|
+
**Layouts:**
|
|
139
|
+
- grid-layout, flex-layout, flex-cards, flex-dashboard
|
|
140
|
+
- dashboard-grid, masonry-grid
|
|
141
|
+
|
|
142
|
+
**Games (16):**
|
|
143
|
+
- tic-tac-toe, memory-game, snake-game, guess-number
|
|
144
|
+
- game-2048, whack-a-mole, simon-says, rock-paper-scissors
|
|
145
|
+
- breakout, tetris, flappy-bird, connect-four
|
|
146
|
+
- blackjack, slot-machine, dice-game, pong
|
|
147
|
+
|
|
148
|
+
### React Components (6)
|
|
149
|
+
|
|
150
|
+
- Button, Card, Counter, Form, Modal, Todo List
|
|
151
|
+
|
|
152
|
+
## Performance Considerations
|
|
153
|
+
|
|
154
|
+
### HTML/CSS/JS:
|
|
155
|
+
- ✅ Faster initial load (no framework)
|
|
156
|
+
- ✅ Smaller file sizes
|
|
157
|
+
- ✅ Better for static content
|
|
158
|
+
- ⚠️ Manual DOM updates can be slow at scale
|
|
159
|
+
|
|
160
|
+
### React:
|
|
161
|
+
- ⚠️ Larger bundle size (React library)
|
|
162
|
+
- ✅ Efficient updates with Virtual DOM
|
|
163
|
+
- ✅ Better for dynamic content
|
|
164
|
+
- ✅ Optimized rendering with reconciliation
|
|
165
|
+
|
|
166
|
+
## Development Experience
|
|
167
|
+
|
|
168
|
+
### HTML/CSS/JS:
|
|
169
|
+
```bash
|
|
170
|
+
# Create and run
|
|
171
|
+
create-template create -c button -n my-button
|
|
172
|
+
cd my-button
|
|
173
|
+
# Open index.html - Done! ✅
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Pros:**
|
|
177
|
+
- No installation time
|
|
178
|
+
- Works everywhere
|
|
179
|
+
- Easy to debug
|
|
180
|
+
- Instant preview
|
|
181
|
+
|
|
182
|
+
**Cons:**
|
|
183
|
+
- Manual DOM manipulation
|
|
184
|
+
- No component composition
|
|
185
|
+
- Harder to maintain at scale
|
|
186
|
+
|
|
187
|
+
### React:
|
|
188
|
+
```bash
|
|
189
|
+
# Create and run
|
|
190
|
+
create-template create --react -c button -n my-button
|
|
191
|
+
cd my-button
|
|
192
|
+
npm install # 30-60 seconds
|
|
193
|
+
npm run dev # Starts dev server
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
**Pros:**
|
|
197
|
+
- Hot Module Replacement
|
|
198
|
+
- Component composition
|
|
199
|
+
- Easy state management
|
|
200
|
+
- Better tooling
|
|
201
|
+
|
|
202
|
+
**Cons:**
|
|
203
|
+
- Requires Node.js
|
|
204
|
+
- Build step needed
|
|
205
|
+
- Steeper learning curve
|
|
206
|
+
|
|
207
|
+
## Migration Path
|
|
208
|
+
|
|
209
|
+
### Start with HTML, Move to React:
|
|
210
|
+
|
|
211
|
+
1. **Learn basics with HTML templates**
|
|
212
|
+
```bash
|
|
213
|
+
create-template create -c button -n html-button
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
2. **Get comfortable with React**
|
|
217
|
+
```bash
|
|
218
|
+
create-template create --react -c button -n react-button
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
3. **Compare and learn the differences**
|
|
222
|
+
|
|
223
|
+
4. **Choose based on project needs**
|
|
224
|
+
|
|
225
|
+
## Recommendations by Project Type
|
|
226
|
+
|
|
227
|
+
### Choose HTML/CSS/JS for:
|
|
228
|
+
- 📄 Portfolio websites
|
|
229
|
+
- 🎯 Landing pages
|
|
230
|
+
- 📚 Documentation sites
|
|
231
|
+
- 🎮 Simple games
|
|
232
|
+
- 📧 Email templates
|
|
233
|
+
- 🎨 Quick prototypes
|
|
234
|
+
- 🏢 Small business sites
|
|
235
|
+
|
|
236
|
+
### Choose React for:
|
|
237
|
+
- 📱 Mobile-like web apps
|
|
238
|
+
- 🎛️ Admin dashboards
|
|
239
|
+
- 📊 Data visualization
|
|
240
|
+
- ✅ Task management apps
|
|
241
|
+
- 🛒 E-commerce apps
|
|
242
|
+
- 💬 Chat applications
|
|
243
|
+
- 🎮 Complex game interfaces
|
|
244
|
+
|
|
245
|
+
## Cost Considerations
|
|
246
|
+
|
|
247
|
+
### HTML/CSS/JS:
|
|
248
|
+
- **Hosting**: Cheapest (static hosting)
|
|
249
|
+
- **CDN**: Very affordable
|
|
250
|
+
- **Bandwidth**: Minimal
|
|
251
|
+
- **Servers**: No server-side logic needed
|
|
252
|
+
|
|
253
|
+
### React:
|
|
254
|
+
- **Hosting**: Static hosting (after build)
|
|
255
|
+
- **CDN**: Same as HTML
|
|
256
|
+
- **Bandwidth**: Slightly more (React bundle)
|
|
257
|
+
- **Build Time**: Requires build step in CI/CD
|
|
258
|
+
|
|
259
|
+
## Conclusion
|
|
260
|
+
|
|
261
|
+
**Both options are great!** The choice depends on your:
|
|
262
|
+
- Project complexity
|
|
263
|
+
- Team expertise
|
|
264
|
+
- Performance requirements
|
|
265
|
+
- Development timeline
|
|
266
|
+
- Maintenance needs
|
|
267
|
+
|
|
268
|
+
**General Rule:**
|
|
269
|
+
- Simple project? → HTML/CSS/JS ✅
|
|
270
|
+
- Complex app? → React ⚛️
|
|
271
|
+
- Not sure? → Start with HTML/CSS/JS, migrate if needed
|
|
272
|
+
|
|
273
|
+
## Still Unsure?
|
|
274
|
+
|
|
275
|
+
Try both and see which fits your workflow:
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
# Try HTML version
|
|
279
|
+
create-template create -c counter -n counter-html
|
|
280
|
+
|
|
281
|
+
# Try React version
|
|
282
|
+
create-template create --react -c counter -n counter-react
|
|
283
|
+
|
|
284
|
+
# Compare the code!
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
**Need help deciding?** [Open an issue](https://github.com/benshabbat/create-template-html-css/issues) and we'll help you choose! 💡
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
# React Quick Start Guide ⚛️
|
|
2
|
+
|
|
3
|
+
Get started with React component generation in seconds!
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g create-template-html-css
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Create Your First React Component
|
|
12
|
+
|
|
13
|
+
### Interactive Mode (Recommended)
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
create-template create
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
1. Select **React (JSX + CSS)** as your framework
|
|
20
|
+
2. Choose a component type (Button, Card, Counter, Form, Modal, or Todo List)
|
|
21
|
+
3. Enter a name for your project
|
|
22
|
+
4. Choose a color scheme (optional)
|
|
23
|
+
|
|
24
|
+
### Quick Commands
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# Create a React button
|
|
28
|
+
create-template create --react -c button -n my-button
|
|
29
|
+
|
|
30
|
+
# Create a React counter
|
|
31
|
+
create-template create --react -c counter -n my-counter
|
|
32
|
+
|
|
33
|
+
# Create a React todo list with ocean colors
|
|
34
|
+
create-template create --react -c todo-list -n my-todos --color-scheme ocean
|
|
35
|
+
|
|
36
|
+
# Create a React form with custom colors
|
|
37
|
+
create-template create --react -c form -n contact-form --primary-color "#FF5733"
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Run Your React Project
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
cd my-counter
|
|
44
|
+
npm install
|
|
45
|
+
npm run dev
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Open [http://localhost:5173](http://localhost:5173) in your browser.
|
|
49
|
+
|
|
50
|
+
## Available React Components
|
|
51
|
+
|
|
52
|
+
### 🔘 Button
|
|
53
|
+
A customizable button component with variants and sizes.
|
|
54
|
+
|
|
55
|
+
**Features:**
|
|
56
|
+
- Variants: primary, secondary, success, danger
|
|
57
|
+
- Sizes: small, medium, large
|
|
58
|
+
- Disabled state support
|
|
59
|
+
- Click handlers
|
|
60
|
+
|
|
61
|
+
**Usage:**
|
|
62
|
+
```jsx
|
|
63
|
+
<Button variant="primary" size="medium" onClick={handleClick}>
|
|
64
|
+
Click Me
|
|
65
|
+
</Button>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 🎴 Card
|
|
69
|
+
Display content in an elegant card with image support.
|
|
70
|
+
|
|
71
|
+
**Features:**
|
|
72
|
+
- Optional image header
|
|
73
|
+
- Title and description
|
|
74
|
+
- Custom footer content
|
|
75
|
+
- Hover effects
|
|
76
|
+
- Dark mode support
|
|
77
|
+
|
|
78
|
+
**Usage:**
|
|
79
|
+
```jsx
|
|
80
|
+
<Card
|
|
81
|
+
title="Beautiful Card"
|
|
82
|
+
description="This is a card description"
|
|
83
|
+
image="https://via.placeholder.com/400x200"
|
|
84
|
+
footer={<button>Learn More</button>}
|
|
85
|
+
/>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### 🔢 Counter
|
|
89
|
+
Interactive counter with increment/decrement functionality.
|
|
90
|
+
|
|
91
|
+
**Features:**
|
|
92
|
+
- Customizable initial value
|
|
93
|
+
- Min/max limits
|
|
94
|
+
- Custom step size
|
|
95
|
+
- Reset button
|
|
96
|
+
- Change callback
|
|
97
|
+
|
|
98
|
+
**Usage:**
|
|
99
|
+
```jsx
|
|
100
|
+
<Counter
|
|
101
|
+
initialValue={0}
|
|
102
|
+
min={0}
|
|
103
|
+
max={100}
|
|
104
|
+
step={1}
|
|
105
|
+
onChange={(value) => console.log(value)}
|
|
106
|
+
/>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### 📝 Form
|
|
110
|
+
Flexible form component with built-in validation.
|
|
111
|
+
|
|
112
|
+
**Features:**
|
|
113
|
+
- Multiple field types (text, email, textarea, select)
|
|
114
|
+
- Required field validation
|
|
115
|
+
- Pattern matching
|
|
116
|
+
- Custom error messages
|
|
117
|
+
- Min length validation
|
|
118
|
+
|
|
119
|
+
**Usage:**
|
|
120
|
+
```jsx
|
|
121
|
+
<Form
|
|
122
|
+
title="Contact Form"
|
|
123
|
+
fields={[
|
|
124
|
+
{ name: 'name', label: 'Name', type: 'text', required: true },
|
|
125
|
+
{ name: 'email', label: 'Email', type: 'email', required: true },
|
|
126
|
+
{ name: 'message', label: 'Message', type: 'textarea', required: true }
|
|
127
|
+
]}
|
|
128
|
+
onSubmit={(data) => console.log(data)}
|
|
129
|
+
/>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### 🪟 Modal
|
|
133
|
+
Dialog modal component with overlay.
|
|
134
|
+
|
|
135
|
+
**Features:**
|
|
136
|
+
- Customizable sizes (small, medium, large)
|
|
137
|
+
- Close on overlay click
|
|
138
|
+
- Optional close button
|
|
139
|
+
- Custom footer
|
|
140
|
+
- Smooth animations
|
|
141
|
+
|
|
142
|
+
**Usage:**
|
|
143
|
+
```jsx
|
|
144
|
+
<Modal
|
|
145
|
+
isOpen={isOpen}
|
|
146
|
+
onClose={() => setIsOpen(false)}
|
|
147
|
+
title="Modal Title"
|
|
148
|
+
size="medium"
|
|
149
|
+
>
|
|
150
|
+
<p>Modal content goes here</p>
|
|
151
|
+
</Modal>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### ✅ Todo List
|
|
155
|
+
Complete todo list with CRUD operations.
|
|
156
|
+
|
|
157
|
+
**Features:**
|
|
158
|
+
- Add new tasks
|
|
159
|
+
- Toggle complete status
|
|
160
|
+
- Delete tasks
|
|
161
|
+
- Task statistics (active/completed)
|
|
162
|
+
- Smooth animations
|
|
163
|
+
|
|
164
|
+
**Usage:**
|
|
165
|
+
```jsx
|
|
166
|
+
<TodoList />
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Project Structure
|
|
170
|
+
|
|
171
|
+
When you create a React component, you'll get:
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
my-counter/
|
|
175
|
+
├── src/
|
|
176
|
+
│ ├── components/
|
|
177
|
+
│ │ └── Counter/
|
|
178
|
+
│ │ ├── Counter.jsx # Component logic
|
|
179
|
+
│ │ └── Counter.css # Component styles
|
|
180
|
+
│ ├── App.jsx # Main app component
|
|
181
|
+
│ └── index.js # Entry point
|
|
182
|
+
├── index.html # HTML template
|
|
183
|
+
├── package.json # Dependencies
|
|
184
|
+
├── vite.config.js # Vite configuration
|
|
185
|
+
├── .gitignore # Git ignore rules
|
|
186
|
+
└── README.md # Project documentation
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Customization
|
|
190
|
+
|
|
191
|
+
### Colors
|
|
192
|
+
|
|
193
|
+
All components support color customization:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
# Use preset color schemes
|
|
197
|
+
create-template create --react -c button --color-scheme ocean
|
|
198
|
+
create-template create --react -c card --color-scheme sunset
|
|
199
|
+
|
|
200
|
+
# Use custom colors
|
|
201
|
+
create-template create --react -c counter --primary-color "#667eea" --secondary-color "#764ba2"
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
**Available color schemes:**
|
|
205
|
+
- ocean, sunset, forest, purple, minimal, coral, teal, neon, vibrant, pastel
|
|
206
|
+
|
|
207
|
+
### Modify Components
|
|
208
|
+
|
|
209
|
+
All generated components are fully editable:
|
|
210
|
+
|
|
211
|
+
1. Navigate to `src/components/[ComponentName]/`
|
|
212
|
+
2. Edit `ComponentName.jsx` for logic
|
|
213
|
+
3. Edit `ComponentName.css` for styles
|
|
214
|
+
4. Update `App.jsx` to use your component
|
|
215
|
+
|
|
216
|
+
### Add Dependencies
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
# Add any npm package
|
|
220
|
+
npm install axios
|
|
221
|
+
npm install react-router-dom
|
|
222
|
+
npm install styled-components
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Build for Production
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
npm run build
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
This creates a `dist/` folder with optimized production files.
|
|
232
|
+
|
|
233
|
+
## Preview Production Build
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
npm run preview
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## Tips
|
|
240
|
+
|
|
241
|
+
1. **Hot Module Replacement**: Vite provides instant updates when you edit files
|
|
242
|
+
2. **Component Isolation**: Each component is self-contained with its own CSS
|
|
243
|
+
3. **Easy Integration**: Copy components to existing React projects
|
|
244
|
+
4. **TypeScript**: Add TypeScript support by renaming `.jsx` to `.tsx` and installing types
|
|
245
|
+
5. **State Management**: Add Redux, Zustand, or other state libraries as needed
|
|
246
|
+
|
|
247
|
+
## Examples
|
|
248
|
+
|
|
249
|
+
### Create Multiple Components
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
# Create a button project
|
|
253
|
+
create-template create --react -c button -n awesome-button
|
|
254
|
+
|
|
255
|
+
# Create a form project
|
|
256
|
+
create-template create --react -c form -n contact-form
|
|
257
|
+
|
|
258
|
+
# Create a todo app
|
|
259
|
+
create-template create --react -c todo-list -n my-todos
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### Integrate into Existing Project
|
|
263
|
+
|
|
264
|
+
1. Generate component:
|
|
265
|
+
```bash
|
|
266
|
+
create-template create --react -c card -n temp-card
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
2. Copy component files:
|
|
270
|
+
```bash
|
|
271
|
+
cp -r temp-card/src/components/Card ./src/components/
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
3. Import in your app:
|
|
275
|
+
```jsx
|
|
276
|
+
import Card from './components/Card/Card';
|
|
277
|
+
import './components/Card/Card.css';
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
## Need Help?
|
|
281
|
+
|
|
282
|
+
- 📚 [Full Documentation](https://github.com/benshabbat/create-template-html-css)
|
|
283
|
+
- 🐛 [Report Issues](https://github.com/benshabbat/create-template-html-css/issues)
|
|
284
|
+
- 💡 [Request Features](https://github.com/benshabbat/create-template-html-css/issues/new)
|
|
285
|
+
|
|
286
|
+
## Next Steps
|
|
287
|
+
|
|
288
|
+
- Explore all 6 React components
|
|
289
|
+
- Try different color schemes
|
|
290
|
+
- Customize components to your needs
|
|
291
|
+
- Build your React app!
|
|
292
|
+
|
|
293
|
+
Happy coding! 🚀
|