Skip to content

Commit 3b9c7a4

Browse files
committed
style: apply prettier formatting to documentation files
- Format EXAMPLES.md with consistent code block styling - Fix line endings in capture-screenshots.js - Apply consistent markdown formatting to README.md
1 parent 137c816 commit 3b9c7a4

File tree

3 files changed

+63
-41
lines changed

3 files changed

+63
-41
lines changed

EXAMPLES.md

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,14 @@ php -S localhost:8080 -t examples # Using PHP
2929
### 📄 Available Example Pages
3030

3131
#### 1. **Main Interactive Demo** (`index.html`)
32+
3233
- Live customization controls
3334
- Real-time preview
3435
- Export functionality
3536
- All basic options
3637

3738
#### 2. **Advanced Customization** (`advanced-demo.html`)
39+
3840
- 100+ QR code variations
3941
- All shape combinations
4042
- Gradient examples
@@ -43,18 +45,21 @@ php -S localhost:8080 -t examples # Using PHP
4345
- Logo integration
4446

4547
#### 3. **Simple Usage** (`simple-usage.html`)
48+
4649
- Basic implementation
4750
- Common use cases
4851
- Template examples (WiFi, vCard, etc.)
4952
- Copy & paste code snippets
5053

5154
#### 4. **API Documentation** (`api-docs.html`)
55+
5256
- Complete props reference
5357
- Method documentation
5458
- TypeScript interfaces
5559
- Hook examples
5660

5761
#### 5. **Detectability Test** (`qr-test.html`)
62+
5863
- Test QR code scanning
5964
- Contrast validation
6065
- Real-time detectability feedback
@@ -67,18 +72,15 @@ php -S localhost:8080 -t examples # Using PHP
6772
```tsx
6873
import { ReactQrCode } from '@devmehq/react-qr-code'
6974

70-
<ReactQrCode
71-
value="https://example.com"
72-
size={256}
73-
/>
75+
;<ReactQrCode value="https://example.com" size={256} />
7476
```
7577

7678
### With Custom Styling
7779

7880
```tsx
7981
import { AdvancedQRCode } from '@devmehq/react-qr-code'
8082

81-
<AdvancedQRCode
83+
;<AdvancedQRCode
8284
value="https://example.com"
8385
size={300}
8486
eyeShape="rounded"
@@ -95,7 +97,7 @@ import { AdvancedQRCode } from '@devmehq/react-qr-code'
9597
bodyGradient={{
9698
type: 'linear',
9799
colors: ['#667EEA', '#764BA2'],
98-
angle: 45
100+
angle: 45,
99101
}}
100102
/>
101103
```
@@ -116,7 +118,7 @@ import { AdvancedQRCode } from '@devmehq/react-qr-code'
116118
```tsx
117119
import { AdvancedQRCode, QRHelpers } from '@devmehq/react-qr-code'
118120

119-
<AdvancedQRCode
121+
;<AdvancedQRCode
120122
value={QRHelpers.wifi('NetworkName', 'password123', 'WPA2')}
121123
theme="professional"
122124
/>
@@ -131,7 +133,7 @@ import { AdvancedQRCode, QRHelpers } from '@devmehq/react-qr-code'
131133
lastName: 'Doe',
132134
phone: '+1234567890',
133135
134-
organization: 'ACME Corp'
136+
organization: 'ACME Corp',
135137
})}
136138
theme="elegant"
137139
/>
@@ -142,36 +144,42 @@ import { AdvancedQRCode, QRHelpers } from '@devmehq/react-qr-code'
142144
The library includes 25+ professionally designed themes:
143145

144146
### Minimal & Clean
147+
145148
- `minimal` - Clean black and white
146149
- `monochrome` - Grayscale elegance
147150
- `elegant` - Sophisticated style
148151
- `professional` - Business ready
149152

150153
### Colorful & Vibrant
154+
151155
- `ocean` - Deep blue waves
152156
- `sunset` - Warm orange/pink
153157
- `forest` - Natural greens
154158
- `rainbow` - Full spectrum
155159
- `aurora` - Northern lights
156160

157161
### Tech & Modern
162+
158163
- `neon` - Bright cyber green
159164
- `cyberpunk` - Tech noir
160165
- `retrowave` - 80s aesthetic
161166
- `gradient` - Modern gradients
162167

163168
### Nature & Earth
169+
164170
- `earth` - Natural browns
165171
- `nature` - Green harmony
166172
- `ice` - Cool blues
167173
- `fire` - Hot reds
168174

169175
### Metallic
176+
170177
- `gold` - Luxurious gold
171178
- `silver` - Sleek silver
172179
- `bronze` - Warm bronze
173180

174181
### Special
182+
175183
- `cosmic` - Space theme
176184
- `pastel` - Soft colors
177185
- `dark` - Dark mode
@@ -181,6 +189,7 @@ The library includes 25+ professionally designed themes:
181189
## 🔧 Customization Options
182190

183191
### Eye (Finder Pattern) Shapes
192+
184193
- `square` - Classic square
185194
- `circle` - Smooth circles
186195
- `rounded` - Rounded corners
@@ -193,6 +202,7 @@ The library includes 25+ professionally designed themes:
193202
- `cat` - Cat eyes
194203

195204
### Body (Data Module) Shapes
205+
196206
- `square` - Traditional pixels
197207
- `circle` - Circular dots
198208
- `rounded` - Soft corners
@@ -213,6 +223,7 @@ The library includes 25+ professionally designed themes:
213223
- `fluid` - Fluid design
214224

215225
### Background Patterns
226+
216227
- `none` - Solid color
217228
- `dots` - Dot pattern
218229
- `lines` - Line pattern
@@ -229,11 +240,13 @@ The library includes 25+ professionally designed themes:
229240
## 📊 Performance Tips
230241

231242
1. **Use Canvas for Large QR Codes**
243+
232244
```tsx
233245
<ReactQrCode renderAs="canvas" size={512} />
234246
```
235247

236248
2. **Enable Lazy Loading**
249+
237250
```tsx
238251
<AdvancedQRCode lazy={true} />
239252
```
@@ -246,24 +259,22 @@ The library includes 25+ professionally designed themes:
246259
4. **Batch Rendering**
247260
```tsx
248261
// Render multiple QR codes efficiently
249-
const codes = data.map(item => (
250-
<AdvancedQRCode
251-
key={item.id}
252-
value={item.value}
253-
lazy={true}
254-
/>
262+
const codes = data.map((item) => (
263+
<AdvancedQRCode key={item.id} value={item.value} lazy={true} />
255264
))
256265
```
257266

258267
## 🧪 Testing Detectability
259268

260269
Use the `qr-test.html` page to:
270+
261271
1. Test QR code scanning with real devices
262272
2. Validate contrast ratios
263273
3. Check error correction levels
264274
4. Verify logo doesn't interfere
265275

266276
### Recommended Contrast Ratios
277+
267278
- **Minimum**: 3:1
268279
- **Recommended**: 7:1
269280
- **Best**: 10:1+
@@ -281,6 +292,7 @@ Use the `qr-test.html` page to:
281292
## 🎯 Common Use Cases
282293

283294
### Event Tickets
295+
284296
```tsx
285297
<AdvancedQRCode
286298
value={`TICKET:${eventId}:${userId}`}
@@ -290,15 +302,13 @@ Use the `qr-test.html` page to:
290302
```
291303

292304
### Product Labels
305+
293306
```tsx
294-
<AdvancedQRCode
295-
value={`PRODUCT:${sku}:${batch}`}
296-
theme="minimal"
297-
size={150}
298-
/>
307+
<AdvancedQRCode value={`PRODUCT:${sku}:${batch}`} theme="minimal" size={150} />
299308
```
300309

301310
### Restaurant Menus
311+
302312
```tsx
303313
<AdvancedQRCode
304314
value="https://restaurant.com/menu"
@@ -308,6 +318,7 @@ Use the `qr-test.html` page to:
308318
```
309319

310320
### Social Media
321+
311322
```tsx
312323
<AdvancedQRCode
313324
value={`instagram://user?username=${username}`}
@@ -320,4 +331,4 @@ Use the `qr-test.html` page to:
320331
- [GitHub Repository](https://github.com/devmehq/react-qr-code)
321332
- [NPM Package](https://www.npmjs.com/package/@devmehq/react-qr-code)
322333
- [Issue Tracker](https://github.com/devmehq/react-qr-code/issues)
323-
- [Discussions](https://github.com/devmehq/react-qr-code/discussions)
334+
- [Discussions](https://github.com/devmehq/react-qr-code/discussions)

README.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ function App() {
192192
```
193193

194194
**25+ Built-in Themes:**
195+
195196
- `minimal`, `gradient`, `ocean`, `sunset`, `forest`
196197
- `neon`, `cyberpunk`, `retrowave`, `pastel`, `dark`
197198
- `colorful`, `monochrome`, `gold`, `silver`, `bronze`
@@ -350,10 +351,8 @@ import { ReactQrCode, QRHelpers } from '@devmehq/react-qr-code'
350351
// Eye (finder pattern) shapes
351352
eyeShape="rounded" // square, circle, rounded, leaf, star, diamond, hexagon, octagon, flower, cat
352353
eyeFrameShape="rounded" // square, circle, rounded, dots, lines, zigzag, waves, cross, mesh, gradient
353-
354-
// Body (data module) shapes
354+
// Body (data module) shapes
355355
bodyShape="circle" // square, circle, rounded, diamond, star, hexagon, octagon, triangle, cross, plus, dots, lines, zigzag, waves, noise, circuit, organic, fluid
356-
357356
// Background patterns
358357
backgroundPattern="dots" // none, dots, lines, grid, mesh, circuit, waves, noise, gradient, radial, hexagon, triangle
359358
/>
@@ -406,40 +405,45 @@ interface AdvancedQRCodeProps {
406405
value: string
407406
size?: number
408407
level?: 'L' | 'M' | 'Q' | 'H'
409-
408+
410409
// Themes
411410
theme?: PresetTheme
412-
colorBlindMode?: 'none' | 'protanopia' | 'deuteranopia' | 'tritanopia' | 'achromatopsia'
413-
411+
colorBlindMode?:
412+
| 'none'
413+
| 'protanopia'
414+
| 'deuteranopia'
415+
| 'tritanopia'
416+
| 'achromatopsia'
417+
414418
// Shapes
415419
eyeShape?: EyeShape
416420
eyeFrameShape?: EyeFrameShape
417421
bodyShape?: BodyShape
418-
422+
419423
// Colors
420424
eyeColor?: string | GradientConfig
421425
eyeFrameColor?: string | GradientConfig
422426
bodyColor?: string | GradientConfig
423427
backgroundColor?: string | GradientConfig
424-
428+
425429
// Gradients
426430
eyeGradient?: GradientConfig
427431
bodyGradient?: GradientConfig
428432
backgroundGradient?: GradientConfig
429-
433+
430434
// Patterns
431435
backgroundPattern?: BackgroundPattern
432-
436+
433437
// Effects
434438
animationType?: 'none' | 'fade' | 'scale' | 'rotate' | 'slide' | 'bounce'
435439
glowEffect?: boolean
436440
shadowEffect?: boolean
437-
441+
438442
// Logo
439443
logo?: string
440444
logoSize?: number
441445
logoExcavate?: boolean
442-
446+
443447
// Actions
444448
enableDownload?: boolean
445449
enableCopy?: boolean

test/capture-screenshots.js

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async function captureScreenshots() {
4747
try {
4848
for (const pageConfig of PAGES_TO_CAPTURE) {
4949
const page = await browser.newPage()
50-
50+
5151
if (pageConfig.viewport) {
5252
await page.setViewport(pageConfig.viewport)
5353
} else {
@@ -56,12 +56,15 @@ async function captureScreenshots() {
5656

5757
const url = `${SERVER_URL}/${pageConfig.url}`
5858
console.log(`📸 Capturing ${pageConfig.name} from ${url}`)
59-
59+
6060
await page.goto(url, { waitUntil: 'networkidle2' })
61-
await new Promise(resolve => setTimeout(resolve, 2000))
61+
await new Promise((resolve) => setTimeout(resolve, 2000))
6262

6363
// Capture full page
64-
const screenshotPath = path.join(SCREENSHOTS_DIR, `${pageConfig.name}.png`)
64+
const screenshotPath = path.join(
65+
SCREENSHOTS_DIR,
66+
`${pageConfig.name}.png`
67+
)
6568
await page.screenshot({ path: screenshotPath, fullPage: true })
6669
console.log(` ✅ Saved: ${screenshotPath}`)
6770

@@ -90,8 +93,10 @@ async function captureScreenshots() {
9093
// Capture individual QR code examples
9194
const page = await browser.newPage()
9295
await page.setViewport({ width: 1920, height: 1080 })
93-
await page.goto(`${SERVER_URL}/advanced-demo.html`, { waitUntil: 'networkidle2' })
94-
await new Promise(resolve => setTimeout(resolve, 3000))
96+
await page.goto(`${SERVER_URL}/advanced-demo.html`, {
97+
waitUntil: 'networkidle2',
98+
})
99+
await new Promise((resolve) => setTimeout(resolve, 3000))
95100

96101
// Capture specific QR code examples
97102
const examples = [
@@ -107,7 +112,10 @@ async function captureScreenshots() {
107112
try {
108113
const element = await page.$(example.selector)
109114
if (element) {
110-
const screenshotPath = path.join(SCREENSHOTS_DIR, `${example.name}.png`)
115+
const screenshotPath = path.join(
116+
SCREENSHOTS_DIR,
117+
`${example.name}.png`
118+
)
111119
await element.screenshot({ path: screenshotPath })
112120
console.log(` ✅ Saved QR: ${screenshotPath}`)
113121
}
@@ -118,10 +126,9 @@ async function captureScreenshots() {
118126

119127
await page.close()
120128
console.log('\n✨ Screenshots captured successfully!')
121-
122129
} finally {
123130
await browser.close()
124131
}
125132
}
126133

127-
captureScreenshots().catch(console.error)
134+
captureScreenshots().catch(console.error)

0 commit comments

Comments
 (0)