@champpaba/claude-agent-kit 1.0.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/LICENSE +21 -0
- package/README.md +561 -0
- package/bin/cli.js +61 -0
- package/lib/init.js +52 -0
- package/lib/update.js +73 -0
- package/package.json +47 -0
- package/template/.claude/CHANGELOG-v1.1.1.md +259 -0
- package/template/.claude/CLAUDE.md +329 -0
- package/template/.claude/agents/01-integration.md +797 -0
- package/template/.claude/agents/02-uxui-frontend.md +899 -0
- package/template/.claude/agents/03-test-debug.md +759 -0
- package/template/.claude/agents/04-frontend.md +1099 -0
- package/template/.claude/agents/05-backend.md +1217 -0
- package/template/.claude/agents/06-database.md +969 -0
- package/template/.claude/commands/agentsetup.md +1464 -0
- package/template/.claude/commands/cdev.md +327 -0
- package/template/.claude/commands/csetup.md +447 -0
- package/template/.claude/commands/cstatus.md +60 -0
- package/template/.claude/commands/cview.md +364 -0
- package/template/.claude/commands/psetup.md +101 -0
- package/template/.claude/contexts/design/accessibility.md +611 -0
- package/template/.claude/contexts/design/box-thinking.md +553 -0
- package/template/.claude/contexts/design/color-theory.md +498 -0
- package/template/.claude/contexts/design/index.md +247 -0
- package/template/.claude/contexts/design/layout.md +400 -0
- package/template/.claude/contexts/design/responsive.md +551 -0
- package/template/.claude/contexts/design/shadows.md +522 -0
- package/template/.claude/contexts/design/spacing.md +428 -0
- package/template/.claude/contexts/design/typography.md +465 -0
- package/template/.claude/contexts/domain/README.md +164 -0
- package/template/.claude/contexts/patterns/agent-coordination.md +388 -0
- package/template/.claude/contexts/patterns/agent-discovery.md +182 -0
- package/template/.claude/contexts/patterns/change-workflow.md +538 -0
- package/template/.claude/contexts/patterns/code-standards.md +515 -0
- package/template/.claude/contexts/patterns/development-principles.md +513 -0
- package/template/.claude/contexts/patterns/error-handling.md +478 -0
- package/template/.claude/contexts/patterns/error-recovery.md +365 -0
- package/template/.claude/contexts/patterns/frontend-component-strategy.md +365 -0
- package/template/.claude/contexts/patterns/git-workflow.md +207 -0
- package/template/.claude/contexts/patterns/logging.md +424 -0
- package/template/.claude/contexts/patterns/task-breakdown.md +452 -0
- package/template/.claude/contexts/patterns/task-classification.md +523 -0
- package/template/.claude/contexts/patterns/tdd-classification.md +516 -0
- package/template/.claude/contexts/patterns/testing.md +413 -0
- package/template/.claude/contexts/patterns/ui-component-consistency.md +304 -0
- package/template/.claude/contexts/patterns/validation-framework.md +776 -0
- package/template/.claude/lib/README.md +39 -0
- package/template/.claude/lib/agent-executor.md +258 -0
- package/template/.claude/lib/agent-router.md +572 -0
- package/template/.claude/lib/flags-updater.md +469 -0
- package/template/.claude/lib/tdd-classifier.md +345 -0
- package/template/.claude/lib/validation-gates.md +484 -0
- package/template/.claude/settings.local.json +42 -0
- package/template/.claude/templates/context-template.md +45 -0
- package/template/.claude/templates/flags-template.json +42 -0
- package/template/.claude/templates/phase-templates.json +124 -0
- package/template/.claude/templates/phases-sections/accessibility-test.md +17 -0
- package/template/.claude/templates/phases-sections/api-design.md +37 -0
- package/template/.claude/templates/phases-sections/backend-tests.md +16 -0
- package/template/.claude/templates/phases-sections/backend.md +37 -0
- package/template/.claude/templates/phases-sections/business-logic-validation.md +16 -0
- package/template/.claude/templates/phases-sections/component-tests.md +17 -0
- package/template/.claude/templates/phases-sections/contract-backend.md +16 -0
- package/template/.claude/templates/phases-sections/contract-frontend.md +16 -0
- package/template/.claude/templates/phases-sections/database.md +35 -0
- package/template/.claude/templates/phases-sections/documentation.md +17 -0
- package/template/.claude/templates/phases-sections/e2e-tests.md +16 -0
- package/template/.claude/templates/phases-sections/fix-implementation.md +17 -0
- package/template/.claude/templates/phases-sections/frontend-integration.md +18 -0
- package/template/.claude/templates/phases-sections/frontend-mockup.md +123 -0
- package/template/.claude/templates/phases-sections/manual-flow-test.md +15 -0
- package/template/.claude/templates/phases-sections/manual-ux-test.md +16 -0
- package/template/.claude/templates/phases-sections/refactor-implementation.md +17 -0
- package/template/.claude/templates/phases-sections/refactor.md +16 -0
- package/template/.claude/templates/phases-sections/regression-tests.md +15 -0
- package/template/.claude/templates/phases-sections/report.md +16 -0
- package/template/.claude/templates/phases-sections/responsive-test.md +16 -0
- package/template/.claude/templates/phases-sections/script-implementation.md +43 -0
- package/template/.claude/templates/phases-sections/test-coverage.md +16 -0
- package/template/.claude/templates/phases-sections/user-approval.md +14 -0
|
@@ -0,0 +1,553 @@
|
|
|
1
|
+
# Box Thinking Framework
|
|
2
|
+
|
|
3
|
+
> **Purpose:** Analyze and plan layouts by thinking of all elements as boxes
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Core Philosophy
|
|
8
|
+
|
|
9
|
+
**Every element on a screen is a box.**
|
|
10
|
+
|
|
11
|
+
Before writing any layout code, **observe and describe**:
|
|
12
|
+
1. What boxes exist?
|
|
13
|
+
2. How do boxes relate to each other?
|
|
14
|
+
3. How do boxes move when resized?
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## The Box Analysis Method
|
|
19
|
+
|
|
20
|
+
### Step 1: Identify All Boxes
|
|
21
|
+
|
|
22
|
+
> "Take a step back and observe **every element on the screen** — navigation, headers, cards, buttons, sidebars, text blocks — everything that occupies space. Imagine **each of them as a box**."
|
|
23
|
+
|
|
24
|
+
**Example: E-commerce Product Page**
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
Boxes identified:
|
|
28
|
+
├─ Header Box (navigation, logo, cart)
|
|
29
|
+
├─ Hero Box (product image + title)
|
|
30
|
+
├─ Sidebar Box (filters, categories)
|
|
31
|
+
├─ Main Content Box
|
|
32
|
+
│ ├─ Product Grid Box
|
|
33
|
+
│ │ ├─ Product Card Box 1
|
|
34
|
+
│ │ ├─ Product Card Box 2
|
|
35
|
+
│ │ └─ Product Card Box 3
|
|
36
|
+
│ └─ Pagination Box
|
|
37
|
+
└─ Footer Box (links, copyright)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
### Step 2: Describe Box Relationships
|
|
43
|
+
|
|
44
|
+
**5 Types of Relationships:**
|
|
45
|
+
|
|
46
|
+
#### 1. Container Boxes (Hierarchy)
|
|
47
|
+
**What contains what?**
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
Header Box CONTAINS:
|
|
51
|
+
├─ Logo Box
|
|
52
|
+
├─ Navigation Box (contains menu items)
|
|
53
|
+
└─ User Actions Box (contains cart, profile)
|
|
54
|
+
|
|
55
|
+
Product Card Box CONTAINS:
|
|
56
|
+
├─ Image Box
|
|
57
|
+
├─ Title Box
|
|
58
|
+
├─ Price Box
|
|
59
|
+
└─ Button Box
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Code Implication:**
|
|
63
|
+
```html
|
|
64
|
+
<header class="header-box">
|
|
65
|
+
<div class="logo-box">Logo</div>
|
|
66
|
+
<nav class="nav-box">
|
|
67
|
+
<a>Home</a>
|
|
68
|
+
<a>Products</a>
|
|
69
|
+
</nav>
|
|
70
|
+
<div class="actions-box">
|
|
71
|
+
<button>Cart</button>
|
|
72
|
+
</div>
|
|
73
|
+
</header>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
#### 2. Adjacent Boxes (Side-by-Side)
|
|
79
|
+
**Which boxes sit next to each other?**
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
Desktop Layout:
|
|
83
|
+
[Sidebar Box] [Main Content Box]
|
|
84
|
+
|
|
85
|
+
Header Layout:
|
|
86
|
+
[Logo Box] [Nav Box] [Actions Box]
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Code Implication:**
|
|
90
|
+
```css
|
|
91
|
+
.header-box {
|
|
92
|
+
display: flex;
|
|
93
|
+
justify-content: space-between;
|
|
94
|
+
align-items: center;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.layout {
|
|
98
|
+
display: grid;
|
|
99
|
+
grid-template-columns: 250px 1fr;
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
#### 3. Nested Boxes (Parent-Child)
|
|
106
|
+
**How deep does nesting go?**
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
Page Box
|
|
110
|
+
└─ Section Box
|
|
111
|
+
└─ Container Box
|
|
112
|
+
└─ Card Box
|
|
113
|
+
└─ Content Box
|
|
114
|
+
├─ Title Box
|
|
115
|
+
└─ Text Box
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**⚠️ Warning:** Too much nesting = complex CSS
|
|
119
|
+
**Rule:** Max 3-4 levels deep
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
#### 4. Space Flow (Gaps Between Boxes)
|
|
124
|
+
**How does space flow between boxes?**
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
Vertical Flow (Stack):
|
|
128
|
+
┌─────────────┐
|
|
129
|
+
│ Header Box │ ← 16px gap ↓
|
|
130
|
+
├─────────────┤
|
|
131
|
+
│ Hero Box │ ← 24px gap ↓
|
|
132
|
+
├─────────────┤
|
|
133
|
+
│ Content Box │ ← 24px gap ↓
|
|
134
|
+
└─────────────┘
|
|
135
|
+
|
|
136
|
+
Horizontal Flow (Inline):
|
|
137
|
+
[Logo] ←20px→ [Nav] ←20px→ [Actions]
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**Code Implication:**
|
|
141
|
+
```css
|
|
142
|
+
.stack {
|
|
143
|
+
display: flex;
|
|
144
|
+
flex-direction: column;
|
|
145
|
+
gap: var(--spacing-6); /* 24px */
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.inline {
|
|
149
|
+
display: flex;
|
|
150
|
+
gap: var(--spacing-5); /* 20px */
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
#### 5. Alignment Logic
|
|
157
|
+
**How do boxes position relative to each other?**
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
Top-aligned:
|
|
161
|
+
┌──┐ ┌────┐ ┌──────┐
|
|
162
|
+
│ │ │ │ │ │
|
|
163
|
+
│ │ │ │ └──────┘
|
|
164
|
+
│ │ └────┘
|
|
165
|
+
└──┘
|
|
166
|
+
|
|
167
|
+
Center-aligned:
|
|
168
|
+
┌────┐
|
|
169
|
+
┌──┐ │ │ ┌──────┐
|
|
170
|
+
│ │ │ │ │ │
|
|
171
|
+
└──┘ │ │ └──────┘
|
|
172
|
+
└────┘
|
|
173
|
+
|
|
174
|
+
Bottom-aligned:
|
|
175
|
+
┌──┐
|
|
176
|
+
│ │ ┌────┐
|
|
177
|
+
│ │ │ │ ┌──────┐
|
|
178
|
+
└──┘ └────┘ └──────┘
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**Code Implication:**
|
|
182
|
+
```css
|
|
183
|
+
.align-top { align-items: flex-start; }
|
|
184
|
+
.align-center { align-items: center; }
|
|
185
|
+
.align-bottom { align-items: flex-end; }
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Box Behavior in Responsive Context
|
|
191
|
+
|
|
192
|
+
### Question to Ask:
|
|
193
|
+
|
|
194
|
+
> "How does this layout behave when the screen or container changes size? Think in terms of **movement, proportion, and flow**, not pixels. Which sections move above or below others? Which expand, and which step back?"
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
### 4 Box Movement Patterns
|
|
199
|
+
|
|
200
|
+
#### 1. Stacking (Horizontal → Vertical)
|
|
201
|
+
|
|
202
|
+
**Desktop (Wide Screen):**
|
|
203
|
+
```
|
|
204
|
+
┌────────────┬──────────────────┐
|
|
205
|
+
│ Sidebar │ Main Content │
|
|
206
|
+
│ Box │ Box │
|
|
207
|
+
└────────────┴──────────────────┘
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
**Mobile (Narrow Screen):**
|
|
211
|
+
```
|
|
212
|
+
┌──────────────────┐
|
|
213
|
+
│ Main Content Box │
|
|
214
|
+
├──────────────────┤
|
|
215
|
+
│ Sidebar Box │
|
|
216
|
+
└──────────────────┘
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
**Code:**
|
|
220
|
+
```css
|
|
221
|
+
.container {
|
|
222
|
+
display: flex;
|
|
223
|
+
gap: var(--spacing-6);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
@media (max-width: 768px) {
|
|
227
|
+
.container {
|
|
228
|
+
flex-direction: column;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
#### 2. Merging (Multiple → Single)
|
|
236
|
+
|
|
237
|
+
**Desktop (3 columns):**
|
|
238
|
+
```
|
|
239
|
+
┌─────┬─────┬─────┐
|
|
240
|
+
│ Box │ Box │ Box │
|
|
241
|
+
│ 1 │ 2 │ 3 │
|
|
242
|
+
└─────┴─────┴─────┘
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
**Tablet (2 columns):**
|
|
246
|
+
```
|
|
247
|
+
┌─────────┬─────────┐
|
|
248
|
+
│ Box 1 │ Box 2 │
|
|
249
|
+
├─────────┴─────────┤
|
|
250
|
+
│ Box 3 │
|
|
251
|
+
└───────────────────┘
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
**Mobile (1 column):**
|
|
255
|
+
```
|
|
256
|
+
┌───────────────────┐
|
|
257
|
+
│ Box 1 │
|
|
258
|
+
├───────────────────┤
|
|
259
|
+
│ Box 2 │
|
|
260
|
+
├───────────────────┤
|
|
261
|
+
│ Box 3 │
|
|
262
|
+
└───────────────────┘
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
**Code:**
|
|
266
|
+
```css
|
|
267
|
+
.grid {
|
|
268
|
+
display: grid;
|
|
269
|
+
gap: var(--spacing-4);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/* Desktop: 3 columns */
|
|
273
|
+
@media (min-width: 1024px) {
|
|
274
|
+
.grid { grid-template-columns: repeat(3, 1fr); }
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/* Tablet: 2 columns */
|
|
278
|
+
@media (min-width: 640px) and (max-width: 1023px) {
|
|
279
|
+
.grid { grid-template-columns: repeat(2, 1fr); }
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/* Mobile: 1 column */
|
|
283
|
+
@media (max-width: 639px) {
|
|
284
|
+
.grid { grid-template-columns: 1fr; }
|
|
285
|
+
}
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
#### 3. Prioritizing (Show Important, Hide Secondary)
|
|
291
|
+
|
|
292
|
+
**Desktop (Show All):**
|
|
293
|
+
```
|
|
294
|
+
┌─────┬──────────┬────────┬─────┐
|
|
295
|
+
│Logo │ Nav │ Search │ User│
|
|
296
|
+
└─────┴──────────┴────────┴─────┘
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
**Mobile (Hide Nav, Show Hamburger):**
|
|
300
|
+
```
|
|
301
|
+
┌─────┬──────────────┬─────┐
|
|
302
|
+
│Logo │ │ ☰ │
|
|
303
|
+
└─────┴──────────────┴─────┘
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
**Code:**
|
|
307
|
+
```css
|
|
308
|
+
.nav { display: flex; }
|
|
309
|
+
.hamburger { display: none; }
|
|
310
|
+
|
|
311
|
+
@media (max-width: 768px) {
|
|
312
|
+
.nav { display: none; }
|
|
313
|
+
.hamburger { display: block; }
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
---
|
|
318
|
+
|
|
319
|
+
#### 4. Compressing (Shrink, Maintain Relationships)
|
|
320
|
+
|
|
321
|
+
**Desktop (Generous Spacing):**
|
|
322
|
+
```
|
|
323
|
+
┌─────────────────────────┐
|
|
324
|
+
│ │
|
|
325
|
+
│ Hero Box │ ← 48px padding
|
|
326
|
+
│ │
|
|
327
|
+
└─────────────────────────┘
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
**Mobile (Compact Spacing):**
|
|
331
|
+
```
|
|
332
|
+
┌───────────────┐
|
|
333
|
+
│ Hero Box │ ← 16px padding
|
|
334
|
+
└───────────────┘
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
**Code:**
|
|
338
|
+
```css
|
|
339
|
+
.hero {
|
|
340
|
+
padding: var(--spacing-12); /* 48px on desktop */
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
@media (max-width: 768px) {
|
|
344
|
+
.hero {
|
|
345
|
+
padding: var(--spacing-4); /* 16px on mobile */
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
## Box Implementation Rules
|
|
353
|
+
|
|
354
|
+
### Margins (Space Outside Box)
|
|
355
|
+
|
|
356
|
+
**Use for:** Pushing boxes away from each other
|
|
357
|
+
|
|
358
|
+
```css
|
|
359
|
+
.box {
|
|
360
|
+
margin-bottom: var(--spacing-6); /* 24px gap below */
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/* Or use gap in parent */
|
|
364
|
+
.container {
|
|
365
|
+
display: flex;
|
|
366
|
+
gap: var(--spacing-6); /* 24px between all children */
|
|
367
|
+
}
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
**Prefer `gap` over `margin`** (cleaner, more predictable)
|
|
371
|
+
|
|
372
|
+
---
|
|
373
|
+
|
|
374
|
+
### Padding (Space Inside Box)
|
|
375
|
+
|
|
376
|
+
**Use for:** Creating breathing room inside a box
|
|
377
|
+
|
|
378
|
+
```css
|
|
379
|
+
.card-box {
|
|
380
|
+
padding: var(--spacing-6); /* 24px inside box */
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
.button-box {
|
|
384
|
+
padding: var(--spacing-2) var(--spacing-4); /* 8px top/bottom, 16px left/right */
|
|
385
|
+
}
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
---
|
|
389
|
+
|
|
390
|
+
### Borders (Box Boundaries)
|
|
391
|
+
|
|
392
|
+
**Use sparingly** - Prefer color/shadow for separation
|
|
393
|
+
|
|
394
|
+
```css
|
|
395
|
+
/* ❌ Heavy borders everywhere */
|
|
396
|
+
.box {
|
|
397
|
+
border: 2px solid black;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/* ✅ Subtle separation */
|
|
401
|
+
.box {
|
|
402
|
+
border: 1px solid rgb(0 0 0 / 0.1);
|
|
403
|
+
box-shadow: var(--shadow-sm);
|
|
404
|
+
}
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
**Alternative:** Use background color contrast instead of borders
|
|
408
|
+
|
|
409
|
+
---
|
|
410
|
+
|
|
411
|
+
### Consistent Gaps
|
|
412
|
+
|
|
413
|
+
**Always use spacing scale:**
|
|
414
|
+
|
|
415
|
+
```css
|
|
416
|
+
/* ✅ Good */
|
|
417
|
+
gap: var(--spacing-4); /* 16px */
|
|
418
|
+
gap: var(--spacing-6); /* 24px */
|
|
419
|
+
|
|
420
|
+
/* ❌ Bad */
|
|
421
|
+
gap: 17px; /* Arbitrary value */
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
---
|
|
425
|
+
|
|
426
|
+
## Practical Example: Product Card
|
|
427
|
+
|
|
428
|
+
### Box Analysis
|
|
429
|
+
|
|
430
|
+
**Identify Boxes:**
|
|
431
|
+
```
|
|
432
|
+
Product Card Box
|
|
433
|
+
├─ Image Box
|
|
434
|
+
├─ Content Box
|
|
435
|
+
│ ├─ Title Box
|
|
436
|
+
│ ├─ Price Box
|
|
437
|
+
│ └─ Description Box
|
|
438
|
+
└─ Action Box
|
|
439
|
+
└─ Button Box
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
**Relationships:**
|
|
443
|
+
- Container: Card contains Image, Content, Action
|
|
444
|
+
- Nested: Content contains Title, Price, Description
|
|
445
|
+
- Vertical Flow: Image → Content → Action
|
|
446
|
+
- Gaps: 16px between sections
|
|
447
|
+
|
|
448
|
+
**Responsive Behavior:**
|
|
449
|
+
- Desktop: Image left, Content right (side-by-side)
|
|
450
|
+
- Mobile: Image top, Content bottom (stacked)
|
|
451
|
+
|
|
452
|
+
---
|
|
453
|
+
|
|
454
|
+
### Implementation
|
|
455
|
+
|
|
456
|
+
```html
|
|
457
|
+
<div class="product-card-box">
|
|
458
|
+
<div class="image-box">
|
|
459
|
+
<img src="product.jpg" alt="Product">
|
|
460
|
+
</div>
|
|
461
|
+
<div class="content-box">
|
|
462
|
+
<h3 class="title-box">Product Title</h3>
|
|
463
|
+
<p class="price-box">$99.99</p>
|
|
464
|
+
<p class="description-box">Description text</p>
|
|
465
|
+
</div>
|
|
466
|
+
<div class="action-box">
|
|
467
|
+
<button class="button-box">Add to Cart</button>
|
|
468
|
+
</div>
|
|
469
|
+
</div>
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
```css
|
|
473
|
+
/* Box structure */
|
|
474
|
+
.product-card-box {
|
|
475
|
+
display: flex;
|
|
476
|
+
flex-direction: column;
|
|
477
|
+
gap: var(--spacing-4); /* 16px between sections */
|
|
478
|
+
padding: var(--spacing-6); /* 24px inside card */
|
|
479
|
+
border-radius: var(--spacing-2);
|
|
480
|
+
box-shadow: var(--shadow-sm);
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/* Content box (nested) */
|
|
484
|
+
.content-box {
|
|
485
|
+
display: flex;
|
|
486
|
+
flex-direction: column;
|
|
487
|
+
gap: var(--spacing-2); /* 8px between title/price/desc */
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/* Responsive: side-by-side on desktop */
|
|
491
|
+
@media (min-width: 768px) {
|
|
492
|
+
.product-card-box {
|
|
493
|
+
flex-direction: row;
|
|
494
|
+
align-items: center;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
.image-box {
|
|
498
|
+
flex-shrink: 0;
|
|
499
|
+
width: 200px;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
.content-box {
|
|
503
|
+
flex: 1;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
---
|
|
509
|
+
|
|
510
|
+
## Best Practices
|
|
511
|
+
|
|
512
|
+
### DO:
|
|
513
|
+
- ✅ Identify all boxes before coding
|
|
514
|
+
- ✅ Describe relationships in plain language
|
|
515
|
+
- ✅ Think in terms of movement (stack, merge, compress)
|
|
516
|
+
- ✅ Use consistent gaps (spacing scale)
|
|
517
|
+
- ✅ Keep nesting shallow (max 3-4 levels)
|
|
518
|
+
- ✅ Test responsive behavior on real devices
|
|
519
|
+
|
|
520
|
+
### DON'T:
|
|
521
|
+
- ❌ Jump straight to code without box analysis
|
|
522
|
+
- ❌ Use arbitrary spacing values
|
|
523
|
+
- ❌ Nest boxes too deeply (> 4 levels)
|
|
524
|
+
- ❌ Forget responsive behavior
|
|
525
|
+
- ❌ Think in pixels (think in relationships)
|
|
526
|
+
|
|
527
|
+
---
|
|
528
|
+
|
|
529
|
+
## Quick Reference
|
|
530
|
+
|
|
531
|
+
**Box Analysis Questions:**
|
|
532
|
+
1. What boxes exist? (List all elements)
|
|
533
|
+
2. What contains what? (Hierarchy)
|
|
534
|
+
3. What's next to what? (Adjacent)
|
|
535
|
+
4. How does space flow? (Gaps)
|
|
536
|
+
5. How do boxes align? (Top/Center/Bottom)
|
|
537
|
+
6. How do boxes move? (Stack/Merge/Compress)
|
|
538
|
+
|
|
539
|
+
**Box Implementation:**
|
|
540
|
+
- **Margins**: Space outside (prefer `gap`)
|
|
541
|
+
- **Padding**: Space inside
|
|
542
|
+
- **Borders**: Use sparingly (prefer shadows)
|
|
543
|
+
- **Gaps**: Use spacing scale (4, 8, 16, 24, 32, 48px)
|
|
544
|
+
|
|
545
|
+
**Responsive Patterns:**
|
|
546
|
+
- **Stacking**: Horizontal → Vertical
|
|
547
|
+
- **Merging**: 3 cols → 2 cols → 1 col
|
|
548
|
+
- **Prioritizing**: Show essential, hide secondary
|
|
549
|
+
- **Compressing**: Reduce spacing, maintain structure
|
|
550
|
+
|
|
551
|
+
---
|
|
552
|
+
|
|
553
|
+
**💡 Remember:** If you can't describe the boxes and their relationships, you can't build the layout!
|