@caddis/cli 0.0.0 → 0.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.
- package/LICENSE +21 -0
- package/README.md +150 -1
- package/bundles/antigravity-plugin/agents/code-reviewer.md +47 -0
- package/bundles/antigravity-plugin/agents/preflight.md +53 -0
- package/bundles/antigravity-plugin/guard_agy.py +338 -0
- package/bundles/antigravity-plugin/hooks.json +36 -0
- package/bundles/antigravity-plugin/mcp_config.json +8 -0
- package/bundles/antigravity-plugin/mcp_ping_server.py +55 -0
- package/bundles/antigravity-plugin/plugin.json +5 -0
- package/bundles/antigravity-plugin/session_end_agy.py +57 -0
- package/bundles/antigravity-plugin/skills/_registry.md +115 -0
- package/bundles/antigravity-plugin/skills/add-rules/SKILL.md +45 -0
- package/bundles/antigravity-plugin/skills/api-design/SKILL.md +249 -0
- package/bundles/antigravity-plugin/skills/backend-development/SKILL.md +305 -0
- package/bundles/antigravity-plugin/skills/best-practices/SKILL.md +500 -0
- package/bundles/antigravity-plugin/skills/best-practices/agents/best-practices-referencer.md +263 -0
- package/bundles/antigravity-plugin/skills/best-practices/agents/codebase-context-builder.md +326 -0
- package/bundles/antigravity-plugin/skills/best-practices/agents/task-intent-analyzer.md +245 -0
- package/bundles/antigravity-plugin/skills/best-practices/references/anti-patterns.md +571 -0
- package/bundles/antigravity-plugin/skills/best-practices/references/before-after-examples.md +1114 -0
- package/bundles/antigravity-plugin/skills/best-practices/references/best-practices-guide.md +513 -0
- package/bundles/antigravity-plugin/skills/best-practices/references/common-workflows.md +692 -0
- package/bundles/antigravity-plugin/skills/best-practices/references/prompt-patterns.md +547 -0
- package/bundles/antigravity-plugin/skills/brainstorming/SKILL.md +57 -0
- package/bundles/antigravity-plugin/skills/ci-cd-pipeline/SKILL.md +315 -0
- package/bundles/antigravity-plugin/skills/code-documentation/SKILL.md +271 -0
- package/bundles/antigravity-plugin/skills/code-review/SKILL.md +122 -0
- package/bundles/antigravity-plugin/skills/codebase-audit/SKILL.md +204 -0
- package/bundles/antigravity-plugin/skills/context-curator/SKILL.md +157 -0
- package/bundles/antigravity-plugin/skills/cross-review/SKILL.md +40 -0
- package/bundles/antigravity-plugin/skills/css-architecture/SKILL.md +305 -0
- package/bundles/antigravity-plugin/skills/css-architecture/references/RESPONSIVE-DESIGN.md +604 -0
- package/bundles/antigravity-plugin/skills/database-design/SKILL.md +177 -0
- package/bundles/antigravity-plugin/skills/db-diagram/SKILL.md +148 -0
- package/bundles/antigravity-plugin/skills/db-diagram/scripts/sql_to_graph.py +1212 -0
- package/bundles/antigravity-plugin/skills/digress/SKILL.md +61 -0
- package/bundles/antigravity-plugin/skills/draw-io/SKILL.md +162 -0
- package/bundles/antigravity-plugin/skills/draw-io/references/aws-icons.md +677 -0
- package/bundles/antigravity-plugin/skills/draw-io/references/layout-guidelines.md +142 -0
- package/bundles/antigravity-plugin/skills/draw-io/references/troubleshooting.md +118 -0
- package/bundles/antigravity-plugin/skills/draw-io/references/workflows.md +103 -0
- package/bundles/antigravity-plugin/skills/draw-io/scripts/convert-drawio-to-png.sh +25 -0
- package/bundles/antigravity-plugin/skills/draw-io/scripts/find_aws_icon.py +79 -0
- package/bundles/antigravity-plugin/skills/error-handling/SKILL.md +260 -0
- package/bundles/antigravity-plugin/skills/excalidraw-db/SKILL.md +38 -0
- package/bundles/antigravity-plugin/skills/fastapi-dev/SKILL.md +300 -0
- package/bundles/antigravity-plugin/skills/feature-plan/SKILL.md +198 -0
- package/bundles/antigravity-plugin/skills/frontend-design/SKILL.md +193 -0
- package/bundles/antigravity-plugin/skills/frontend-design/references/my-tech-stack.md +127 -0
- package/bundles/antigravity-plugin/skills/gh-cli/SKILL.md +195 -0
- package/bundles/antigravity-plugin/skills/git-commit/SKILL.md +285 -0
- package/bundles/antigravity-plugin/skills/golden-plan/SKILL.md +577 -0
- package/bundles/antigravity-plugin/skills/handoff/SKILL.md +100 -0
- package/bundles/antigravity-plugin/skills/implement/SKILL.md +114 -0
- package/bundles/antigravity-plugin/skills/javascript-typescript/SKILL.md +142 -0
- package/bundles/antigravity-plugin/skills/kb/SKILL.md +60 -0
- package/bundles/antigravity-plugin/skills/mermaid-db/SKILL.md +33 -0
- package/bundles/antigravity-plugin/skills/mermaid-diagrams/SKILL.md +236 -0
- package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/ENHANCEMENTS.md +264 -0
- package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/MERMAID-SUMMARY.md +137 -0
- package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/advanced-features.md +556 -0
- package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/architecture-diagrams.md +192 -0
- package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/c4-diagrams.md +410 -0
- package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/class-diagrams.md +361 -0
- package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/erd-diagrams.md +510 -0
- package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/flowcharts.md +450 -0
- package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/sequence-diagrams.md +394 -0
- package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/troubleshooting.md +335 -0
- package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/workflows.md +418 -0
- package/bundles/antigravity-plugin/skills/migrate-dir/SKILL.md +68 -0
- package/bundles/antigravity-plugin/skills/mockup/SKILL.md +242 -0
- package/bundles/antigravity-plugin/skills/particle-art/SKILL.md +243 -0
- package/bundles/antigravity-plugin/skills/particle-art/references/canvas-utils.ts +171 -0
- package/bundles/antigravity-plugin/skills/particle-art/references/dot-field.template.tsx +203 -0
- package/bundles/antigravity-plugin/skills/particle-art/references/flow-field.template.tsx +263 -0
- package/bundles/antigravity-plugin/skills/particle-art/references/node-shape.template.tsx +261 -0
- package/bundles/antigravity-plugin/skills/particle-art/references/shape-sampler.ts +281 -0
- package/bundles/antigravity-plugin/skills/particle-art/references/stipple-morph.template.tsx +167 -0
- package/bundles/antigravity-plugin/skills/particle-art/references/stipple.template.tsx +175 -0
- package/bundles/antigravity-plugin/skills/particle-art/references/trail-ghost.template.tsx +266 -0
- package/bundles/antigravity-plugin/skills/particle-art/references/usage-examples.md +320 -0
- package/bundles/antigravity-plugin/skills/playwright/API_REFERENCE.md +653 -0
- package/bundles/antigravity-plugin/skills/playwright/SKILL.md +454 -0
- package/bundles/antigravity-plugin/skills/playwright/lib/helpers.js +441 -0
- package/bundles/antigravity-plugin/skills/playwright/package.json +26 -0
- package/bundles/antigravity-plugin/skills/playwright/run.js +228 -0
- package/bundles/antigravity-plugin/skills/prd/SKILL.md +107 -0
- package/bundles/antigravity-plugin/skills/preflight/SKILL.md +435 -0
- package/bundles/antigravity-plugin/skills/python/SKILL.md +388 -0
- package/bundles/antigravity-plugin/skills/react-best-practices/SKILL.md +269 -0
- package/bundles/antigravity-plugin/skills/react-dev/README.md +404 -0
- package/bundles/antigravity-plugin/skills/react-dev/SKILL.md +459 -0
- package/bundles/antigravity-plugin/skills/react-dev/examples/generic-components.md +579 -0
- package/bundles/antigravity-plugin/skills/react-dev/examples/server-components.md +579 -0
- package/bundles/antigravity-plugin/skills/react-dev/references/event-handlers.md +574 -0
- package/bundles/antigravity-plugin/skills/react-dev/references/hooks.md +456 -0
- package/bundles/antigravity-plugin/skills/react-dev/references/react-19-patterns.md +638 -0
- package/bundles/antigravity-plugin/skills/react-dev/references/react-router.md +1002 -0
- package/bundles/antigravity-plugin/skills/react-dev/references/tanstack-router.md +587 -0
- package/bundles/antigravity-plugin/skills/refactoring/SKILL.md +486 -0
- package/bundles/antigravity-plugin/skills/resume/SKILL.md +36 -0
- package/bundles/antigravity-plugin/skills/security-review/SKILL.md +196 -0
- package/bundles/antigravity-plugin/skills/setup-project-ai/SKILL.md +61 -0
- package/bundles/antigravity-plugin/skills/ship/SKILL.md +107 -0
- package/bundles/antigravity-plugin/skills/ship-merge/SKILL.md +103 -0
- package/bundles/antigravity-plugin/skills/ship-pr/SKILL.md +102 -0
- package/bundles/antigravity-plugin/skills/skill-creator/LICENSE.txt +202 -0
- package/bundles/antigravity-plugin/skills/skill-creator/SKILL.md +491 -0
- package/bundles/antigravity-plugin/skills/skill-creator/agents/analyzer.md +274 -0
- package/bundles/antigravity-plugin/skills/skill-creator/agents/comparator.md +202 -0
- package/bundles/antigravity-plugin/skills/skill-creator/agents/grader.md +223 -0
- package/bundles/antigravity-plugin/skills/skill-creator/assets/eval_review.html +146 -0
- package/bundles/antigravity-plugin/skills/skill-creator/eval-viewer/generate_review.py +471 -0
- package/bundles/antigravity-plugin/skills/skill-creator/eval-viewer/viewer.html +1325 -0
- package/bundles/antigravity-plugin/skills/skill-creator/references/schemas.md +430 -0
- package/bundles/antigravity-plugin/skills/skill-creator/scripts/__init__.py +0 -0
- package/bundles/antigravity-plugin/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
- package/bundles/antigravity-plugin/skills/skill-creator/scripts/generate_report.py +326 -0
- package/bundles/antigravity-plugin/skills/skill-creator/scripts/improve_description.py +247 -0
- package/bundles/antigravity-plugin/skills/skill-creator/scripts/package_skill.py +136 -0
- package/bundles/antigravity-plugin/skills/skill-creator/scripts/quick_validate.py +103 -0
- package/bundles/antigravity-plugin/skills/skill-creator/scripts/run_eval.py +310 -0
- package/bundles/antigravity-plugin/skills/skill-creator/scripts/run_loop.py +328 -0
- package/bundles/antigravity-plugin/skills/skill-creator/scripts/utils.py +47 -0
- package/bundles/antigravity-plugin/skills/sql/SKILL.md +321 -0
- package/bundles/antigravity-plugin/skills/tdd/SKILL.md +37 -0
- package/bundles/antigravity-plugin/skills/tdd-workflow/SKILL.md +188 -0
- package/bundles/antigravity-plugin/skills/technical-writing/SKILL.md +286 -0
- package/bundles/antigravity-plugin/skills/test-strategy/SKILL.md +155 -0
- package/bundles/antigravity-plugin/skills/ui-brief/SKILL.md +84 -0
- package/bundles/antigravity-plugin/skills/ui-review/SKILL.md +176 -0
- package/bundles/antigravity-plugin/skills/ui-review/references/framework-fixes.md +471 -0
- package/bundles/antigravity-plugin/skills/ui-review/references/visual-checklist.md +236 -0
- package/bundles/antigravity-plugin/skills/usage-review/SKILL.md +77 -0
- package/bundles/antigravity-plugin/skills/use-model/SKILL.md +64 -0
- package/bundles/antigravity-plugin/skills/using-git-worktrees/SKILL.md +217 -0
- package/bundles/antigravity-plugin/skills/version/SKILL.md +18 -0
- package/bundles/antigravity-plugin/skills/warm-editorial-ui/DESIGN_TOKENS.md +487 -0
- package/bundles/antigravity-plugin/skills/warm-editorial-ui/IMPLEMENTATION_GUIDE.md +177 -0
- package/bundles/antigravity-plugin/skills/warm-editorial-ui/SKILL.md +732 -0
- package/bundles/antigravity-plugin/skills/webapp-testing/LICENSE.txt +202 -0
- package/bundles/antigravity-plugin/skills/webapp-testing/SKILL.md +97 -0
- package/bundles/antigravity-plugin/skills/webapp-testing/examples/console_logging.py +35 -0
- package/bundles/antigravity-plugin/skills/webapp-testing/examples/element_discovery.py +40 -0
- package/bundles/antigravity-plugin/skills/webapp-testing/examples/static_html_automation.py +33 -0
- package/bundles/antigravity-plugin/skills/webapp-testing/scripts/with_server.py +106 -0
- package/bundles/antigravity-plugin/skills/windows-deployment/SKILL.md +880 -0
- package/bundles/antigravity-plugin/skills/writing-plans/SKILL.md +384 -0
- package/bundles/antigravity-plugin/statusline-command-agy.sh +91 -0
- package/bundles/antigravity-plugin/warm_start_agy.py +149 -0
- package/bundles/manifest.json +6 -0
- package/dist/cli.js +5363 -0
- package/package.json +61 -4
|
@@ -0,0 +1,604 @@
|
|
|
1
|
+
# Responsive Design Reference
|
|
2
|
+
|
|
3
|
+
Detailed reference for implementing responsive, mobile-first designs.
|
|
4
|
+
|
|
5
|
+
## Mobile-First Approach
|
|
6
|
+
|
|
7
|
+
Always start with mobile design, then progressively enhance for larger screens.
|
|
8
|
+
|
|
9
|
+
**Why Mobile-First:**
|
|
10
|
+
- Forces focus on essential content
|
|
11
|
+
- Easier to scale up than scale down
|
|
12
|
+
- Better performance on mobile devices
|
|
13
|
+
- Aligns with usage patterns (mobile-first web)
|
|
14
|
+
|
|
15
|
+
## Breakpoint Strategy
|
|
16
|
+
|
|
17
|
+
### Standard Breakpoints
|
|
18
|
+
|
|
19
|
+
```css
|
|
20
|
+
/* Mobile First Approach */
|
|
21
|
+
/* Base styles: 0-640px (mobile) */
|
|
22
|
+
|
|
23
|
+
/* Small tablets and large phones */
|
|
24
|
+
@media (min-width: 640px) { }
|
|
25
|
+
|
|
26
|
+
/* Tablets */
|
|
27
|
+
@media (min-width: 768px) { }
|
|
28
|
+
|
|
29
|
+
/* Small laptops */
|
|
30
|
+
@media (min-width: 1024px) { }
|
|
31
|
+
|
|
32
|
+
/* Desktops */
|
|
33
|
+
@media (min-width: 1280px) { }
|
|
34
|
+
|
|
35
|
+
/* Large desktops */
|
|
36
|
+
@media (min-width: 1536px) { }
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Specific Breakpoint Ranges
|
|
40
|
+
|
|
41
|
+
| Range | Pixels | Target Devices | Layout Strategy |
|
|
42
|
+
|-------|--------|----------------|-----------------|
|
|
43
|
+
| **XS** | 0-479px | Small phones (iPhone SE, older Android) | Single column, stacked navigation, large touch targets (min 44px) |
|
|
44
|
+
| **SM** | 480-767px | Large phones (iPhone 14, most modern phones) | Single column, simplified UI, bottom navigation, reduced complexity |
|
|
45
|
+
| **MD** | 768-1023px | Tablets (iPad, Android tablets) | 2 columns possible, sidebar navigation, some desktop features |
|
|
46
|
+
| **LG** | 1024-1439px | Small laptops, landscape tablets | Multi-column layouts, full navigation, desktop UI patterns |
|
|
47
|
+
| **XL** | 1440px+ | Desktop monitors, large screens | Max-width containers, multi-panel layouts, advanced features visible |
|
|
48
|
+
|
|
49
|
+
**Mobile Simplification Examples:**
|
|
50
|
+
|
|
51
|
+
- **Navigation**: Hamburger menu (mobile) → Full nav bar (desktop)
|
|
52
|
+
- **Forms**: Stacked fields (mobile) → Side-by-side fields (desktop)
|
|
53
|
+
- **Content**: Single column (mobile) → Multi-column grid (desktop)
|
|
54
|
+
- **Actions**: Fixed bottom bar (mobile) → Inline buttons (desktop)
|
|
55
|
+
- **Tables**: Collapsed cards (mobile) → Full data table (desktop)
|
|
56
|
+
- **Sidebars**: Hidden/collapsible (mobile) → Always visible (desktop)
|
|
57
|
+
- **Filters**: Modal/drawer (mobile) → Sidebar panel (desktop)
|
|
58
|
+
|
|
59
|
+
### Tailwind Responsive Classes
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
<div className="
|
|
63
|
+
w-full // mobile: full width
|
|
64
|
+
sm:w-1/2 // small: half width
|
|
65
|
+
md:w-1/3 // medium: third width
|
|
66
|
+
lg:w-1/4 // large: quarter width
|
|
67
|
+
">
|
|
68
|
+
Responsive width
|
|
69
|
+
</div>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Responsive Images
|
|
73
|
+
|
|
74
|
+
### Using srcset for Responsive Images
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
<img
|
|
78
|
+
src="image-800w.jpg"
|
|
79
|
+
srcSet="
|
|
80
|
+
image-400w.jpg 400w,
|
|
81
|
+
image-800w.jpg 800w,
|
|
82
|
+
image-1200w.jpg 1200w
|
|
83
|
+
"
|
|
84
|
+
sizes="
|
|
85
|
+
(max-width: 640px) 100vw,
|
|
86
|
+
(max-width: 1024px) 50vw,
|
|
87
|
+
33vw
|
|
88
|
+
"
|
|
89
|
+
alt="Descriptive alt text"
|
|
90
|
+
loading="lazy"
|
|
91
|
+
/>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Next.js Image Component
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
import Image from 'next/image';
|
|
98
|
+
|
|
99
|
+
<Image
|
|
100
|
+
src="/hero-image.jpg"
|
|
101
|
+
alt="Descriptive alt text"
|
|
102
|
+
width={1200}
|
|
103
|
+
height={600}
|
|
104
|
+
priority // for above-the-fold images
|
|
105
|
+
className="w-full h-auto"
|
|
106
|
+
/>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Responsive Typography
|
|
110
|
+
|
|
111
|
+
### Fluid Typography with Tailwind
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
<h1 className="
|
|
115
|
+
text-3xl // mobile: 30px
|
|
116
|
+
sm:text-4xl // small: 36px
|
|
117
|
+
md:text-5xl // medium: 48px
|
|
118
|
+
lg:text-6xl // large: 60px
|
|
119
|
+
">
|
|
120
|
+
Responsive Headline
|
|
121
|
+
</h1>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Fluid Typography with CSS Clamp
|
|
125
|
+
|
|
126
|
+
```css
|
|
127
|
+
h1 {
|
|
128
|
+
/* min: 2rem (32px), preferred: 5vw, max: 4rem (64px) */
|
|
129
|
+
font-size: clamp(2rem, 5vw, 4rem);
|
|
130
|
+
line-height: 1.2;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
p {
|
|
134
|
+
/* min: 1rem (16px), preferred: 2.5vw, max: 1.25rem (20px) */
|
|
135
|
+
font-size: clamp(1rem, 2.5vw, 1.25rem);
|
|
136
|
+
line-height: 1.6;
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Responsive Layouts
|
|
141
|
+
|
|
142
|
+
### CSS Grid Responsive Pattern
|
|
143
|
+
|
|
144
|
+
```tsx
|
|
145
|
+
<div className="
|
|
146
|
+
grid
|
|
147
|
+
grid-cols-1 // mobile: 1 column
|
|
148
|
+
sm:grid-cols-2 // small: 2 columns
|
|
149
|
+
md:grid-cols-3 // medium: 3 columns
|
|
150
|
+
lg:grid-cols-4 // large: 4 columns
|
|
151
|
+
gap-4 // consistent gap
|
|
152
|
+
">
|
|
153
|
+
{items.map(item => (
|
|
154
|
+
<Card key={item.id}>{item.content}</Card>
|
|
155
|
+
))}
|
|
156
|
+
</div>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Flexbox Responsive Pattern
|
|
160
|
+
|
|
161
|
+
```tsx
|
|
162
|
+
<div className="
|
|
163
|
+
flex
|
|
164
|
+
flex-col // mobile: stack vertically
|
|
165
|
+
md:flex-row // medium+: horizontal layout
|
|
166
|
+
gap-6
|
|
167
|
+
items-center
|
|
168
|
+
">
|
|
169
|
+
<div className="w-full md:w-1/2">Content Left</div>
|
|
170
|
+
<div className="w-full md:w-1/2">Content Right</div>
|
|
171
|
+
</div>
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Touch-Friendly Interfaces
|
|
175
|
+
|
|
176
|
+
### Touch Target Sizing
|
|
177
|
+
|
|
178
|
+
```tsx
|
|
179
|
+
// Minimum 44x44px touch targets
|
|
180
|
+
<button className="
|
|
181
|
+
min-w-[44px]
|
|
182
|
+
min-h-[44px]
|
|
183
|
+
px-4 py-2
|
|
184
|
+
rounded-lg
|
|
185
|
+
touch-manipulation // prevents 300ms tap delay
|
|
186
|
+
">
|
|
187
|
+
Tap Me
|
|
188
|
+
</button>
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Touch Gestures
|
|
192
|
+
|
|
193
|
+
```tsx
|
|
194
|
+
// Consider common mobile gestures
|
|
195
|
+
<div className="
|
|
196
|
+
overflow-x-auto // horizontal scroll
|
|
197
|
+
snap-x // snap scrolling
|
|
198
|
+
snap-mandatory
|
|
199
|
+
overscroll-contain // prevent bounce on mobile
|
|
200
|
+
">
|
|
201
|
+
{/* Scrollable content */}
|
|
202
|
+
</div>
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Navigation Patterns
|
|
206
|
+
|
|
207
|
+
### Mobile Menu Pattern
|
|
208
|
+
|
|
209
|
+
```tsx
|
|
210
|
+
import { useState } from 'react';
|
|
211
|
+
import { List, X } from '@phosphor-icons/react';
|
|
212
|
+
|
|
213
|
+
export function MobileNav() {
|
|
214
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
215
|
+
|
|
216
|
+
return (
|
|
217
|
+
<>
|
|
218
|
+
{/* Mobile menu button */}
|
|
219
|
+
<button
|
|
220
|
+
onClick={() => setIsOpen(!isOpen)}
|
|
221
|
+
className="md:hidden p-2"
|
|
222
|
+
aria-label="Toggle menu"
|
|
223
|
+
>
|
|
224
|
+
{isOpen ? <X size={24} /> : <List size={24} />}
|
|
225
|
+
</button>
|
|
226
|
+
|
|
227
|
+
{/* Mobile menu overlay */}
|
|
228
|
+
{isOpen && (
|
|
229
|
+
<div className="
|
|
230
|
+
fixed inset-0 z-50 bg-white
|
|
231
|
+
md:hidden
|
|
232
|
+
">
|
|
233
|
+
<nav className="p-6 space-y-4">
|
|
234
|
+
{/* Navigation items */}
|
|
235
|
+
</nav>
|
|
236
|
+
</div>
|
|
237
|
+
)}
|
|
238
|
+
|
|
239
|
+
{/* Desktop navigation */}
|
|
240
|
+
<nav className="hidden md:flex gap-6">
|
|
241
|
+
{/* Navigation items */}
|
|
242
|
+
</nav>
|
|
243
|
+
</>
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Sticky Navigation
|
|
249
|
+
|
|
250
|
+
```tsx
|
|
251
|
+
<header className="
|
|
252
|
+
sticky top-0 z-40
|
|
253
|
+
bg-white/80
|
|
254
|
+
backdrop-blur-md
|
|
255
|
+
border-b border-slate-200
|
|
256
|
+
">
|
|
257
|
+
<nav className="container mx-auto px-4 py-4">
|
|
258
|
+
{/* Navigation content */}
|
|
259
|
+
</nav>
|
|
260
|
+
</header>
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## Responsive Forms
|
|
264
|
+
|
|
265
|
+
### Form Layout Pattern
|
|
266
|
+
|
|
267
|
+
```tsx
|
|
268
|
+
<form className="space-y-6">
|
|
269
|
+
{/* Full width on mobile, side-by-side on desktop */}
|
|
270
|
+
<div className="
|
|
271
|
+
grid
|
|
272
|
+
grid-cols-1
|
|
273
|
+
md:grid-cols-2
|
|
274
|
+
gap-4
|
|
275
|
+
">
|
|
276
|
+
<div>
|
|
277
|
+
<label htmlFor="firstName" className="block text-sm font-medium mb-1">
|
|
278
|
+
First Name
|
|
279
|
+
</label>
|
|
280
|
+
<input
|
|
281
|
+
id="firstName"
|
|
282
|
+
type="text"
|
|
283
|
+
className="
|
|
284
|
+
w-full px-4 py-2
|
|
285
|
+
border border-slate-300
|
|
286
|
+
rounded-lg
|
|
287
|
+
focus:ring-2 focus:ring-blue-500
|
|
288
|
+
touch-manipulation
|
|
289
|
+
"
|
|
290
|
+
/>
|
|
291
|
+
</div>
|
|
292
|
+
|
|
293
|
+
<div>
|
|
294
|
+
<label htmlFor="lastName" className="block text-sm font-medium mb-1">
|
|
295
|
+
Last Name
|
|
296
|
+
</label>
|
|
297
|
+
<input
|
|
298
|
+
id="lastName"
|
|
299
|
+
type="text"
|
|
300
|
+
className="
|
|
301
|
+
w-full px-4 py-2
|
|
302
|
+
border border-slate-300
|
|
303
|
+
rounded-lg
|
|
304
|
+
focus:ring-2 focus:ring-blue-500
|
|
305
|
+
touch-manipulation
|
|
306
|
+
"
|
|
307
|
+
/>
|
|
308
|
+
</div>
|
|
309
|
+
</div>
|
|
310
|
+
|
|
311
|
+
{/* Full width textarea */}
|
|
312
|
+
<div>
|
|
313
|
+
<label htmlFor="message" className="block text-sm font-medium mb-1">
|
|
314
|
+
Message
|
|
315
|
+
</label>
|
|
316
|
+
<textarea
|
|
317
|
+
id="message"
|
|
318
|
+
rows={4}
|
|
319
|
+
className="
|
|
320
|
+
w-full px-4 py-2
|
|
321
|
+
border border-slate-300
|
|
322
|
+
rounded-lg
|
|
323
|
+
focus:ring-2 focus:ring-blue-500
|
|
324
|
+
touch-manipulation
|
|
325
|
+
"
|
|
326
|
+
/>
|
|
327
|
+
</div>
|
|
328
|
+
|
|
329
|
+
<button
|
|
330
|
+
type="submit"
|
|
331
|
+
className="
|
|
332
|
+
w-full md:w-auto
|
|
333
|
+
px-8 py-3
|
|
334
|
+
bg-blue-600 text-white
|
|
335
|
+
rounded-lg
|
|
336
|
+
hover:bg-blue-700
|
|
337
|
+
transition-colors
|
|
338
|
+
touch-manipulation
|
|
339
|
+
"
|
|
340
|
+
>
|
|
341
|
+
Submit
|
|
342
|
+
</button>
|
|
343
|
+
</form>
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
## Responsive Content Hiding
|
|
347
|
+
|
|
348
|
+
### Show/Hide Based on Screen Size
|
|
349
|
+
|
|
350
|
+
```tsx
|
|
351
|
+
<div>
|
|
352
|
+
{/* Show only on mobile */}
|
|
353
|
+
<div className="block md:hidden">
|
|
354
|
+
Mobile content
|
|
355
|
+
</div>
|
|
356
|
+
|
|
357
|
+
{/* Show only on tablet and up */}
|
|
358
|
+
<div className="hidden md:block">
|
|
359
|
+
Desktop content
|
|
360
|
+
</div>
|
|
361
|
+
|
|
362
|
+
{/* Show only on desktop */}
|
|
363
|
+
<div className="hidden lg:block">
|
|
364
|
+
Large screen content
|
|
365
|
+
</div>
|
|
366
|
+
</div>
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
## Performance Optimization
|
|
370
|
+
|
|
371
|
+
### Lazy Loading Images
|
|
372
|
+
|
|
373
|
+
```tsx
|
|
374
|
+
<img
|
|
375
|
+
src="image.jpg"
|
|
376
|
+
alt="Description"
|
|
377
|
+
loading="lazy"
|
|
378
|
+
className="w-full h-auto"
|
|
379
|
+
/>
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
### Responsive Video
|
|
383
|
+
|
|
384
|
+
```tsx
|
|
385
|
+
<div className="relative aspect-video">
|
|
386
|
+
<video
|
|
387
|
+
className="absolute inset-0 w-full h-full object-cover"
|
|
388
|
+
poster="thumbnail.jpg"
|
|
389
|
+
controls
|
|
390
|
+
preload="metadata"
|
|
391
|
+
>
|
|
392
|
+
<source src="video-mobile.mp4" media="(max-width: 640px)" />
|
|
393
|
+
<source src="video-desktop.mp4" />
|
|
394
|
+
</video>
|
|
395
|
+
</div>
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
## Testing Responsive Designs
|
|
399
|
+
|
|
400
|
+
### Browser DevTools
|
|
401
|
+
|
|
402
|
+
1. Open Chrome/Firefox DevTools (F12)
|
|
403
|
+
2. Toggle device toolbar (Ctrl+Shift+M)
|
|
404
|
+
3. Test common breakpoints:
|
|
405
|
+
- iPhone SE (375px)
|
|
406
|
+
- iPhone 12 Pro (390px)
|
|
407
|
+
- iPad (768px)
|
|
408
|
+
- iPad Pro (1024px)
|
|
409
|
+
- Desktop (1280px+)
|
|
410
|
+
|
|
411
|
+
### Real Device Testing
|
|
412
|
+
|
|
413
|
+
**Essential devices to test:**
|
|
414
|
+
- Small phone (iPhone SE, Android small)
|
|
415
|
+
- Large phone (iPhone Pro Max, Android large)
|
|
416
|
+
- Tablet (iPad, Android tablet)
|
|
417
|
+
- Desktop (various resolutions)
|
|
418
|
+
|
|
419
|
+
### Playwright Testing
|
|
420
|
+
|
|
421
|
+
```typescript
|
|
422
|
+
// Use browser automation tools (e.g. Playwright) to test responsive breakpoints
|
|
423
|
+
await page.setViewportSize({ width: 375, height: 667 }); // iPhone SE
|
|
424
|
+
await page.screenshot({ path: 'mobile.png' });
|
|
425
|
+
|
|
426
|
+
await page.setViewportSize({ width: 768, height: 1024 }); // iPad
|
|
427
|
+
await page.screenshot({ path: 'tablet.png' });
|
|
428
|
+
|
|
429
|
+
await page.setViewportSize({ width: 1920, height: 1080 }); // Desktop
|
|
430
|
+
await page.screenshot({ path: 'desktop.png' });
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
## Common Responsive Patterns
|
|
434
|
+
|
|
435
|
+
### Card Grid
|
|
436
|
+
|
|
437
|
+
```tsx
|
|
438
|
+
<div className="
|
|
439
|
+
grid
|
|
440
|
+
grid-cols-1
|
|
441
|
+
sm:grid-cols-2
|
|
442
|
+
lg:grid-cols-3
|
|
443
|
+
xl:grid-cols-4
|
|
444
|
+
gap-6
|
|
445
|
+
p-4
|
|
446
|
+
">
|
|
447
|
+
{items.map(item => (
|
|
448
|
+
<article
|
|
449
|
+
key={item.id}
|
|
450
|
+
className="
|
|
451
|
+
bg-white
|
|
452
|
+
rounded-lg
|
|
453
|
+
border border-slate-200
|
|
454
|
+
overflow-hidden
|
|
455
|
+
hover:shadow-lg
|
|
456
|
+
transition-shadow
|
|
457
|
+
"
|
|
458
|
+
>
|
|
459
|
+
<img
|
|
460
|
+
src={item.image}
|
|
461
|
+
alt={item.title}
|
|
462
|
+
className="w-full h-48 object-cover"
|
|
463
|
+
loading="lazy"
|
|
464
|
+
/>
|
|
465
|
+
<div className="p-4">
|
|
466
|
+
<h3 className="text-lg font-semibold mb-2">{item.title}</h3>
|
|
467
|
+
<p className="text-slate-600">{item.description}</p>
|
|
468
|
+
</div>
|
|
469
|
+
</article>
|
|
470
|
+
))}
|
|
471
|
+
</div>
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
### Hero Section
|
|
475
|
+
|
|
476
|
+
```tsx
|
|
477
|
+
<section className="
|
|
478
|
+
relative
|
|
479
|
+
min-h-screen
|
|
480
|
+
flex items-center
|
|
481
|
+
px-4 sm:px-6 lg:px-8
|
|
482
|
+
">
|
|
483
|
+
<div className="
|
|
484
|
+
max-w-7xl mx-auto w-full
|
|
485
|
+
grid grid-cols-1 lg:grid-cols-2
|
|
486
|
+
gap-12
|
|
487
|
+
items-center
|
|
488
|
+
">
|
|
489
|
+
<div className="space-y-6">
|
|
490
|
+
<h1 className="
|
|
491
|
+
text-4xl sm:text-5xl lg:text-6xl
|
|
492
|
+
font-bold
|
|
493
|
+
tracking-tight
|
|
494
|
+
">
|
|
495
|
+
Your Headline Here
|
|
496
|
+
</h1>
|
|
497
|
+
<p className="
|
|
498
|
+
text-lg sm:text-xl
|
|
499
|
+
text-slate-600
|
|
500
|
+
max-w-2xl
|
|
501
|
+
">
|
|
502
|
+
Supporting description that works across all screen sizes.
|
|
503
|
+
</p>
|
|
504
|
+
<div className="
|
|
505
|
+
flex flex-col sm:flex-row
|
|
506
|
+
gap-4
|
|
507
|
+
">
|
|
508
|
+
<button className="
|
|
509
|
+
px-8 py-3
|
|
510
|
+
bg-blue-600 text-white
|
|
511
|
+
rounded-lg
|
|
512
|
+
hover:bg-blue-700
|
|
513
|
+
transition-colors
|
|
514
|
+
">
|
|
515
|
+
Primary Action
|
|
516
|
+
</button>
|
|
517
|
+
<button className="
|
|
518
|
+
px-8 py-3
|
|
519
|
+
border-2 border-slate-300
|
|
520
|
+
rounded-lg
|
|
521
|
+
hover:border-slate-400
|
|
522
|
+
transition-colors
|
|
523
|
+
">
|
|
524
|
+
Secondary Action
|
|
525
|
+
</button>
|
|
526
|
+
</div>
|
|
527
|
+
</div>
|
|
528
|
+
<div className="
|
|
529
|
+
relative
|
|
530
|
+
aspect-square
|
|
531
|
+
rounded-2xl
|
|
532
|
+
overflow-hidden
|
|
533
|
+
">
|
|
534
|
+
<img
|
|
535
|
+
src="hero-image.jpg"
|
|
536
|
+
alt="Hero"
|
|
537
|
+
className="w-full h-full object-cover"
|
|
538
|
+
/>
|
|
539
|
+
</div>
|
|
540
|
+
</div>
|
|
541
|
+
</section>
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
## Accessibility Considerations
|
|
545
|
+
|
|
546
|
+
### Focus Management on Mobile
|
|
547
|
+
|
|
548
|
+
```tsx
|
|
549
|
+
<button
|
|
550
|
+
className="
|
|
551
|
+
focus:outline-none
|
|
552
|
+
focus:ring-4 focus:ring-blue-500
|
|
553
|
+
focus:ring-offset-2
|
|
554
|
+
rounded-lg
|
|
555
|
+
"
|
|
556
|
+
aria-label="Descriptive label"
|
|
557
|
+
>
|
|
558
|
+
Action
|
|
559
|
+
</button>
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
### Skip Links
|
|
563
|
+
|
|
564
|
+
```tsx
|
|
565
|
+
<a
|
|
566
|
+
href="#main-content"
|
|
567
|
+
className="
|
|
568
|
+
sr-only
|
|
569
|
+
focus:not-sr-only
|
|
570
|
+
focus:absolute
|
|
571
|
+
focus:top-4 focus:left-4
|
|
572
|
+
focus:z-50
|
|
573
|
+
focus:px-4 focus:py-2
|
|
574
|
+
focus:bg-blue-600 focus:text-white
|
|
575
|
+
focus:rounded-lg
|
|
576
|
+
"
|
|
577
|
+
>
|
|
578
|
+
Skip to main content
|
|
579
|
+
</a>
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
## Best Practices Summary
|
|
583
|
+
|
|
584
|
+
✅ **Do:**
|
|
585
|
+
- Start with mobile design first
|
|
586
|
+
- Use relative units (rem, em, %) for flexibility
|
|
587
|
+
- Test on real devices, not just emulators
|
|
588
|
+
- Ensure touch targets are at least 44x44px
|
|
589
|
+
- Use semantic HTML for better accessibility
|
|
590
|
+
- Implement lazy loading for images and videos
|
|
591
|
+
- Optimize assets for mobile networks
|
|
592
|
+
- Use CSS Grid and Flexbox for flexible layouts
|
|
593
|
+
- Provide adequate spacing between interactive elements
|
|
594
|
+
|
|
595
|
+
❌ **Don't:**
|
|
596
|
+
- Design for desktop first and scale down
|
|
597
|
+
- Use fixed pixel widths for layout containers
|
|
598
|
+
- Rely solely on browser DevTools for testing
|
|
599
|
+
- Make touch targets too small
|
|
600
|
+
- Forget keyboard navigation
|
|
601
|
+
- Load all images eagerly
|
|
602
|
+
- Use large unoptimized images on mobile
|
|
603
|
+
- Use complex nested tables for layout
|
|
604
|
+
- Place important actions in hard-to-reach areas
|