@mr.dj2u/knowledge 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/dist/content/checklists/ship-test-loop.md +16 -0
- package/dist/content/checklists/unified-agent-bundle-validation.md +8 -0
- package/dist/content/examples/ship-test-loop.md +13 -0
- package/dist/content/examples/unified-agent-bundle-bootstrap.md +8 -0
- package/dist/content/guides/animation-performance.md +30 -0
- package/dist/content/guides/post-create-onboarding.md +113 -0
- package/dist/content/patterns/api/api-routes.md +314 -0
- package/dist/content/patterns/api/error-handling.md +311 -0
- package/dist/content/patterns/database/drizzle-schema.md +280 -0
- package/dist/content/patterns/database/migrations.md +365 -0
- package/dist/content/patterns/database/query-organization.md +537 -0
- package/dist/content/patterns/database/relations.md +450 -0
- package/dist/content/patterns/deployment/build-configuration.md +452 -0
- package/dist/content/patterns/deployment/ci-cd-patterns.md +448 -0
- package/dist/content/patterns/deployment/environment-config.md +380 -0
- package/dist/content/patterns/deployment/hosting-setup.md +425 -0
- package/dist/content/patterns/project/configuration-patterns.md +459 -0
- package/dist/content/patterns/project/documentation-org.md +506 -0
- package/dist/content/patterns/project/folder-structure.md +398 -0
- package/dist/content/patterns/project/library-exports.md +465 -0
- package/dist/content/patterns/project/monorepo-structure.md +500 -0
- package/dist/content/patterns/routing/dynamic-routes.md +221 -0
- package/dist/content/patterns/routing/file-based-routing.md +186 -0
- package/dist/content/patterns/routing/route-groups.md +429 -0
- package/dist/content/patterns/state/persistence-middleware.md +521 -0
- package/dist/content/patterns/state/selector-hooks.md +538 -0
- package/dist/content/patterns/state/store-organization.md +539 -0
- package/dist/content/patterns/state/zustand-patterns.md +348 -0
- package/dist/content/patterns/styling/component-styling.md +468 -0
- package/dist/content/patterns/styling/responsive-patterns.md +398 -0
- package/dist/content/patterns/styling/theme-configuration.md +426 -0
- package/dist/content/patterns/styling/uniwind-setup.md +412 -0
- package/dist/content/prompts/continue-development.md +27 -0
- package/dist/content/prompts/create-expo-super-stack.md +29 -0
- package/dist/content/prompts/fix-seo.md +29 -0
- package/dist/content/prompts/onboard-new-expo-app.md +11 -0
- package/dist/content/prompts/prepare-deploy.md +29 -0
- package/dist/content/prompts/project-research-plan.md +29 -0
- package/dist/content/prompts/review-expo-project.md +29 -0
- package/dist/content/prompts/run-doctor.md +30 -0
- package/dist/content/prompts/ship-test-loop.md +24 -0
- package/dist/content/reference/create-expo-stack-uniwind.md +29 -0
- package/dist/content/reference/doctor-dogfood.md +42 -0
- package/dist/content/reference/mcp-sdk-transport.md +30 -0
- package/dist/content/reference/package-ci-patterns.md +24 -0
- package/dist/content/reference/reference-repo-evacuation.md +31 -0
- package/dist/content/resource-index.json +67 -0
- package/dist/content/rules/app-folder-architecture.md +13 -0
- package/dist/content/rules/env-hygiene.md +9 -0
- package/dist/content/rules/seo-metadata.md +7 -0
- package/dist/content/rules/ssr-safety.md +9 -0
- package/dist/content/skills/api-routes.md +33 -0
- package/dist/content/skills/continue-development.md +31 -0
- package/dist/content/skills/debugging.md +31 -0
- package/dist/content/skills/deployment.md +32 -0
- package/dist/content/skills/dev-server-management.md +31 -0
- package/dist/content/skills/env-vars.md +32 -0
- package/dist/content/skills/expo-router-architecture.md +33 -0
- package/dist/content/skills/expo-ssr-safety.md +32 -0
- package/dist/content/skills/plugin-creation.md +41 -0
- package/dist/content/skills/production-server-patterns.md +31 -0
- package/dist/content/skills/project-onboarding.md +31 -0
- package/dist/content/skills/research-plan-intake.md +31 -0
- package/dist/content/skills/seo-metadata.md +31 -0
- package/dist/content/skills/super-stack-startup.md +31 -0
- package/dist/content/skills/uniwind-theming.md +32 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +369 -0
- package/dist/index.js.map +1 -0
- package/dist/patterns/index.d.ts +78 -0
- package/dist/patterns/index.d.ts.map +1 -0
- package/dist/patterns/index.js +264 -0
- package/dist/patterns/index.js.map +1 -0
- package/dist/prompts/index.d.ts +35 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +270 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/skills/index.d.ts +3 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +2 -0
- package/dist/skills/index.js.map +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
# Responsive Design Patterns
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
Responsive patterns implement mobile-first breakpoint strategies using Uniwind/Tailwind utilities. Components adapt layout, typography, and spacing across iOS, Android, and Web platforms using responsive class modifiers (sm:, md:, lg:, xl:) and platform-specific code (`.web.tsx`, `.native.tsx`).
|
|
6
|
+
|
|
7
|
+
## When to Use
|
|
8
|
+
|
|
9
|
+
**Use responsive patterns** for:
|
|
10
|
+
- ✅ Multi-platform layouts (mobile, tablet, web)
|
|
11
|
+
- ✅ Breakpoint-specific typography scaling
|
|
12
|
+
- ✅ Flexible grid/column systems
|
|
13
|
+
- ✅ Platform-specific layout adjustments
|
|
14
|
+
- ✅ Safe area insets on mobile
|
|
15
|
+
|
|
16
|
+
## Breakpoints
|
|
17
|
+
|
|
18
|
+
| Breakpoint | Width | Use Case |
|
|
19
|
+
|-----------|-------|----------|
|
|
20
|
+
| `default` | 0px+ | Mobile-first (default) |
|
|
21
|
+
| `sm:` | 640px+ | Large phones, small tablets |
|
|
22
|
+
| `md:` | 768px+ | Tablets |
|
|
23
|
+
| `lg:` | 1024px+ | Tablets, small desktops |
|
|
24
|
+
| `xl:` | 1280px+ | Desktops |
|
|
25
|
+
| `2xl:` | 1536px+ | Large desktops |
|
|
26
|
+
|
|
27
|
+
## Code Example
|
|
28
|
+
|
|
29
|
+
### Mobile-First Grid Layout
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
// File: src/components/ResponsiveGrid.tsx
|
|
33
|
+
import { View } from 'react-native';
|
|
34
|
+
import { ReactNode } from 'react';
|
|
35
|
+
|
|
36
|
+
interface ResponsiveGridProps {
|
|
37
|
+
children: ReactNode;
|
|
38
|
+
columns?: {
|
|
39
|
+
default: number;
|
|
40
|
+
sm?: number;
|
|
41
|
+
md?: number;
|
|
42
|
+
lg?: number;
|
|
43
|
+
xl?: number;
|
|
44
|
+
};
|
|
45
|
+
gap?: 'small' | 'medium' | 'large';
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function ResponsiveGrid({
|
|
49
|
+
children,
|
|
50
|
+
columns = { default: 1, sm: 2, md: 3, lg: 4 },
|
|
51
|
+
gap = 'medium',
|
|
52
|
+
}: ResponsiveGridProps) {
|
|
53
|
+
// Calculate width: 100% / columns for each breakpoint
|
|
54
|
+
const gapClasses = {
|
|
55
|
+
small: 'gap-2',
|
|
56
|
+
medium: 'gap-4',
|
|
57
|
+
large: 'gap-6',
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<View
|
|
62
|
+
className={`
|
|
63
|
+
flex-row flex-wrap
|
|
64
|
+
${gapClasses[gap]}
|
|
65
|
+
w-full
|
|
66
|
+
`}
|
|
67
|
+
>
|
|
68
|
+
{children}
|
|
69
|
+
</View>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Usage:
|
|
74
|
+
function ProductGrid() {
|
|
75
|
+
return (
|
|
76
|
+
<ResponsiveGrid columns={{ default: 1, sm: 2, md: 3, lg: 4 }}>
|
|
77
|
+
{/* Mobile: 1 column */}
|
|
78
|
+
{/* Tablet (md): 3 columns */}
|
|
79
|
+
{/* Desktop (lg): 4 columns */}
|
|
80
|
+
</ResponsiveGrid>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Responsive Typography
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
// File: src/components/ResponsiveHeading.tsx
|
|
89
|
+
import { Text, TextProps } from 'react-native';
|
|
90
|
+
import { useFontSize } from '@/hooks/useFontSize';
|
|
91
|
+
|
|
92
|
+
interface ResponsiveHeadingProps extends TextProps {
|
|
93
|
+
children: string;
|
|
94
|
+
level?: 1 | 2 | 3;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function ResponsiveHeading({
|
|
98
|
+
children,
|
|
99
|
+
level = 1,
|
|
100
|
+
...props
|
|
101
|
+
}: ResponsiveHeadingProps) {
|
|
102
|
+
// Responsive font sizes: mobile first
|
|
103
|
+
const headingStyles = {
|
|
104
|
+
1: 'text-2xl sm:text-3xl md:text-4xl lg:text-5xl', // H1
|
|
105
|
+
2: 'text-xl sm:text-2xl md:text-3xl lg:text-4xl', // H2
|
|
106
|
+
3: 'text-lg sm:text-xl md:text-2xl lg:text-3xl', // H3
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
return (
|
|
110
|
+
<Text
|
|
111
|
+
className={`
|
|
112
|
+
font-bold
|
|
113
|
+
leading-tight
|
|
114
|
+
${headingStyles[level]}
|
|
115
|
+
dark:text-white
|
|
116
|
+
`}
|
|
117
|
+
{...props}
|
|
118
|
+
>
|
|
119
|
+
{children}
|
|
120
|
+
</Text>
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Usage:
|
|
125
|
+
<ResponsiveHeading level={1}>
|
|
126
|
+
Mobile: 24px → Tablet: 30px → Desktop: 36px → Large: 48px
|
|
127
|
+
</ResponsiveHeading>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Platform-Specific Responsive Layout
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
// File: src/components/HeroSection.tsx (default - all platforms)
|
|
134
|
+
import { View, Text } from 'react-native';
|
|
135
|
+
import { Image } from 'expo-image';
|
|
136
|
+
|
|
137
|
+
export function HeroSection() {
|
|
138
|
+
return (
|
|
139
|
+
<View
|
|
140
|
+
className={`
|
|
141
|
+
flex-col md:flex-row
|
|
142
|
+
gap-4 md:gap-8
|
|
143
|
+
w-full
|
|
144
|
+
px-4 md:px-8
|
|
145
|
+
py-8 md:py-16
|
|
146
|
+
`}
|
|
147
|
+
>
|
|
148
|
+
{/* Image: mobile-first (full width) */}
|
|
149
|
+
<View className="w-full md:w-1/2">
|
|
150
|
+
<Image
|
|
151
|
+
source={{ uri: 'https://example.com/hero.jpg' }}
|
|
152
|
+
className="w-full aspect-video rounded-lg"
|
|
153
|
+
/>
|
|
154
|
+
</View>
|
|
155
|
+
|
|
156
|
+
{/* Content: mobile-full width, desktop-50% */}
|
|
157
|
+
<View className="w-full md:w-1/2 justify-center">
|
|
158
|
+
<ResponsiveHeading level={1}>
|
|
159
|
+
Welcome to Our App
|
|
160
|
+
</ResponsiveHeading>
|
|
161
|
+
<Text className="mt-4 text-base md:text-lg leading-relaxed">
|
|
162
|
+
Responsive content for all screen sizes.
|
|
163
|
+
</Text>
|
|
164
|
+
</View>
|
|
165
|
+
</View>
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
```typescript
|
|
171
|
+
// File: src/components/HeroSection.web.tsx (web-specific override)
|
|
172
|
+
import { View, Text } from 'react-native';
|
|
173
|
+
import { Image } from 'expo-image';
|
|
174
|
+
|
|
175
|
+
export function HeroSection() {
|
|
176
|
+
return (
|
|
177
|
+
<View
|
|
178
|
+
className={`
|
|
179
|
+
flex-row
|
|
180
|
+
gap-8
|
|
181
|
+
w-full
|
|
182
|
+
px-8
|
|
183
|
+
py-16
|
|
184
|
+
justify-center
|
|
185
|
+
max-w-6xl
|
|
186
|
+
mx-auto
|
|
187
|
+
`}
|
|
188
|
+
>
|
|
189
|
+
{/* Desktop-optimized layout */}
|
|
190
|
+
<View className="w-1/2">
|
|
191
|
+
<Image
|
|
192
|
+
source={{ uri: 'https://example.com/hero.jpg' }}
|
|
193
|
+
className="w-full aspect-video rounded-lg"
|
|
194
|
+
/>
|
|
195
|
+
</View>
|
|
196
|
+
|
|
197
|
+
<View className="w-1/2 justify-center">
|
|
198
|
+
<Text className="text-5xl font-bold leading-tight">
|
|
199
|
+
Welcome to Our App
|
|
200
|
+
</Text>
|
|
201
|
+
<Text className="mt-6 text-lg leading-relaxed">
|
|
202
|
+
Web-optimized responsive layout.
|
|
203
|
+
</Text>
|
|
204
|
+
</View>
|
|
205
|
+
</View>
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Safe Area Responsive Padding
|
|
211
|
+
|
|
212
|
+
```typescript
|
|
213
|
+
// File: src/components/ScreenContainer.tsx
|
|
214
|
+
import { View, ViewProps } from 'react-native';
|
|
215
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
216
|
+
|
|
217
|
+
interface ScreenContainerProps extends ViewProps {
|
|
218
|
+
children: React.ReactNode;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export function ScreenContainer({
|
|
222
|
+
children,
|
|
223
|
+
className,
|
|
224
|
+
...props
|
|
225
|
+
}: ScreenContainerProps) {
|
|
226
|
+
const insets = useSafeAreaInsets();
|
|
227
|
+
|
|
228
|
+
return (
|
|
229
|
+
<View
|
|
230
|
+
className={`
|
|
231
|
+
flex-1
|
|
232
|
+
bg-[var(--color-background)]
|
|
233
|
+
px-4 md:px-8 lg:px-12
|
|
234
|
+
${className || ''}
|
|
235
|
+
`}
|
|
236
|
+
style={{
|
|
237
|
+
paddingBottom: insets.bottom + 16,
|
|
238
|
+
paddingTop: insets.top + 16,
|
|
239
|
+
}}
|
|
240
|
+
{...props}
|
|
241
|
+
>
|
|
242
|
+
{children}
|
|
243
|
+
</View>
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// Usage:
|
|
248
|
+
function HomeScreen() {
|
|
249
|
+
return (
|
|
250
|
+
<ScreenContainer>
|
|
251
|
+
{/* Content automatically respects safe area */}
|
|
252
|
+
</ScreenContainer>
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### Responsive Form Layout
|
|
258
|
+
|
|
259
|
+
```typescript
|
|
260
|
+
// File: src/components/FormGrid.tsx
|
|
261
|
+
import { View } from 'react-native';
|
|
262
|
+
import { ReactNode } from 'react';
|
|
263
|
+
|
|
264
|
+
interface FormGridProps {
|
|
265
|
+
children: ReactNode;
|
|
266
|
+
columns?: number;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export function FormGrid({
|
|
270
|
+
children,
|
|
271
|
+
columns = 2,
|
|
272
|
+
}: FormGridProps) {
|
|
273
|
+
const columnClass = {
|
|
274
|
+
1: 'md:grid-cols-1',
|
|
275
|
+
2: 'md:grid-cols-2',
|
|
276
|
+
3: 'md:grid-cols-3',
|
|
277
|
+
}[columns] || 'md:grid-cols-2';
|
|
278
|
+
|
|
279
|
+
return (
|
|
280
|
+
<View
|
|
281
|
+
className={`
|
|
282
|
+
flex-col
|
|
283
|
+
${columnClass}
|
|
284
|
+
gap-4 md:gap-6
|
|
285
|
+
w-full
|
|
286
|
+
`}
|
|
287
|
+
>
|
|
288
|
+
{/* Mobile: full-width stacked fields */}
|
|
289
|
+
{/* Tablet+: multi-column layout */}
|
|
290
|
+
{children}
|
|
291
|
+
</View>
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// Usage:
|
|
296
|
+
function UserForm() {
|
|
297
|
+
return (
|
|
298
|
+
<FormGrid columns={2}>
|
|
299
|
+
{/* Each child gets full width on mobile, 50% on tablet+ */}
|
|
300
|
+
</FormGrid>
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
## Configuration
|
|
306
|
+
|
|
307
|
+
### Tailwind Breakpoints
|
|
308
|
+
|
|
309
|
+
```javascript
|
|
310
|
+
// File: tailwind.config.js
|
|
311
|
+
module.exports = {
|
|
312
|
+
theme: {
|
|
313
|
+
screens: {
|
|
314
|
+
'xs': '320px', // Small mobile
|
|
315
|
+
'sm': '640px', // Large phone
|
|
316
|
+
'md': '768px', // Tablet
|
|
317
|
+
'lg': '1024px', // iPad landscape
|
|
318
|
+
'xl': '1280px', // Desktop
|
|
319
|
+
'2xl': '1536px', // Large desktop
|
|
320
|
+
},
|
|
321
|
+
},
|
|
322
|
+
};
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
## Best Practices
|
|
326
|
+
|
|
327
|
+
### ✅ DO
|
|
328
|
+
|
|
329
|
+
1. **Start with mobile-first** — default styles for mobile, then enhance
|
|
330
|
+
```tsx
|
|
331
|
+
<View className="text-base md:text-lg lg:text-xl">
|
|
332
|
+
Mobile: 16px → Tablet: 18px → Desktop: 20px
|
|
333
|
+
</View>
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
2. **Use responsive spacing** to adjust for screen size
|
|
337
|
+
```tsx
|
|
338
|
+
<View className="px-4 md:px-8 lg:px-12 py-4 md:py-8">
|
|
339
|
+
Responsive padding scales with breakpoint
|
|
340
|
+
</View>
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
3. **Create platform-specific overrides** for significant layout changes
|
|
344
|
+
```typescript
|
|
345
|
+
// Component.tsx (all platforms)
|
|
346
|
+
// Component.web.tsx (web-only optimizations)
|
|
347
|
+
// Component.native.tsx (mobile-only optimizations)
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
4. **Use CSS custom properties** for responsive values
|
|
351
|
+
```css
|
|
352
|
+
@layer utilities {
|
|
353
|
+
.container-responsive {
|
|
354
|
+
width: calc(100% - var(--spacing-4));
|
|
355
|
+
max-width: 1024px;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
### ❌ DON'T
|
|
361
|
+
|
|
362
|
+
1. **Don't hardcode fixed widths** — use responsive classes
|
|
363
|
+
```tsx
|
|
364
|
+
// ❌ BAD - fixed width
|
|
365
|
+
<View className="w-300" />
|
|
366
|
+
|
|
367
|
+
// ✅ GOOD - responsive
|
|
368
|
+
<View className="w-full md:w-1/2 lg:w-1/3" />
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
2. **Don't use all breakpoints** — typically only 2-3 needed
|
|
372
|
+
```tsx
|
|
373
|
+
// ❌ EXCESSIVE
|
|
374
|
+
<View className="text-xs sm:text-sm md:text-base lg:text-lg xl:text-xl 2xl:text-2xl" />
|
|
375
|
+
|
|
376
|
+
// ✅ FOCUSED
|
|
377
|
+
<View className="text-base md:text-lg lg:text-xl" />
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
3. **Don't forget safe area insets** on mobile
|
|
381
|
+
```tsx
|
|
382
|
+
// ✅ INCLUDE
|
|
383
|
+
style={{ paddingTop: insets.top + 16 }}
|
|
384
|
+
|
|
385
|
+
// ❌ EXCLUDE
|
|
386
|
+
className="pt-4" // Doesn't account for notch/unsafe areas
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
## Related Patterns
|
|
390
|
+
|
|
391
|
+
- [Uniwind Setup](./uniwind-setup.md) — Uniwind configuration
|
|
392
|
+
- [Theme Configuration](./theme-configuration.md) — Theme tokens
|
|
393
|
+
- [Component Styling](./component-styling.md) — Component patterns
|
|
394
|
+
|
|
395
|
+
---
|
|
396
|
+
|
|
397
|
+
*Pattern extracted from production repositories: expo-super-template, DJsPortfolio, PokePages*
|
|
398
|
+
*Files: responsive layout patterns from Expo Router apps*
|