Skip to content

Commit fed6eb4

Browse files
committed
feat: comprehensive QR code library improvements with advanced customization
Major Enhancements: - 🎨 Added AdvancedQRCode component with 100+ customization options - 🔧 Migrated to TypeScript with strict mode for better type safety - ✨ Implemented 12+ eye shapes, 18+ body patterns, and background effects - 🎭 Added preset themes (neon, cyberpunk, nature, vintage, modern) - 🧪 Added comprehensive test suite with 116 tests and QR detectability validation - 📱 Added QR code decoder functionality for validation - 🚀 Modernized codebase to ES6+ classes and React hooks Features Added: - Eye customization: multiple shapes (circle, leaf, star, diamond, etc.) with gradients - Body customization: fluid connections, patterns, density control - Background patterns: dots, grid, waves, gradients with 12+ options - Color effects: shadow, glow, neon, holographic, metallic - Template support: WiFi, vCard, SMS, email, phone - Export formats: SVG, PNG, JPEG, PDF with customizable quality - Performance optimizations: lazy loading, memoization, debouncing Testing & Quality: - Full test coverage with Jest and React Testing Library - QR code detectability testing with contrast validation - All themes meet minimum 3:1 contrast ratio (most exceed 7:1) - SVG extraction and validation scripts - Fixed all TypeScript errors and warnings Breaking Changes: - Removed legacy function-based components - Updated to React 19 and modern testing libraries - Restructured file organization for better maintainability Documentation: - Added comprehensive API documentation - Created interactive demos with 100+ examples - Added detectability testing tools - Included advanced usage examples
1 parent 73e713d commit fed6eb4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+13322
-1528
lines changed

README.md

Lines changed: 346 additions & 48 deletions
Large diffs are not rendered by default.

examples/README.md

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
# React QR Code Examples 🎨
2+
3+
This directory contains comprehensive examples showcasing all the features of React QR Code library.
4+
5+
## 📁 Files Overview
6+
7+
### 🏠 [index.html](index.html) + [app.jsx](app.jsx)
8+
**Main Demo Page**
9+
- Basic and advanced QR code examples
10+
- Links to all other demos
11+
- Perfect starting point for exploring the library
12+
13+
### 🎨 [advanced-demo.html](advanced-demo.html) + [advanced-demo.jsx](advanced-demo.jsx)
14+
**Complete Feature Showcase**
15+
- **100+ customization examples**
16+
- Eye customization (12+ shapes)
17+
- Body patterns (18+ shapes)
18+
- Background patterns (12+ types)
19+
- All 5 preset themes
20+
- Data type examples (WiFi, vCard, SMS, etc.)
21+
- Animation and effects
22+
- **Best for seeing all possibilities**
23+
24+
### 📚 [simple-usage.html](simple-usage.html)
25+
**Developer Getting Started Guide**
26+
- Step-by-step installation
27+
- Basic usage examples with code
28+
- Common use cases
29+
- **Best for developers getting started**
30+
31+
### 📖 [api-docs.html](api-docs.html)
32+
**Complete API Documentation**
33+
- All props and interfaces
34+
- Method documentation
35+
- TypeScript definitions
36+
- Complete code examples
37+
- **Best for API reference**
38+
39+
## 🚀 Quick Start
40+
41+
1. **Clone or download** this repository
42+
2. **Open any HTML file** in your browser
43+
3. **No build step required** - examples use CDN links
44+
45+
## 🌟 Features Demonstrated
46+
47+
### Basic Features
48+
- ✅ Custom colors and sizes
49+
- ✅ Logo/image embedding
50+
- ✅ Error correction levels
51+
- ✅ SVG and Canvas rendering
52+
- ✅ Margin control
53+
54+
### Advanced Features
55+
-**12+ Eye Shapes**: circle, star, flower, heart, diamond, leaf, hexagon, etc.
56+
-**18+ Body Patterns**: fluid, hexagon, circle, diamond, star, mosaic, etc.
57+
-**12+ Background Patterns**: dots, waves, grid, hexagons, stars, etc.
58+
-**Color Effects**: shadow, glow, neon, holographic, chrome, 3D, etc.
59+
-**Gradients**: linear, radial, conic with multiple stops
60+
-**Animations**: fade-in, scale, rotate, bounce, pulse, etc.
61+
-**5 Preset Themes**: modern, neon, vintage, cyberpunk, nature
62+
63+
### Data Types
64+
-**WiFi Networks**: Auto-connect QR codes
65+
-**Contact vCards**: Phone, email, address, organization
66+
-**SMS Messages**: Pre-filled text messages
67+
-**Emails**: With subject and body
68+
-**Geographic Locations**: GPS coordinates
69+
-**Calendar Events**: Meeting invitations
70+
-**Phone Numbers**: Direct dial
71+
-**URLs and Text**: Basic data types
72+
73+
## 🎯 Example Use Cases
74+
75+
### Business Cards
76+
```javascript
77+
<ReactQrCode
78+
value={QRHelpers.vcard({
79+
firstName: 'John',
80+
lastName: 'Doe',
81+
phone: '+1234567890',
82+
email: 'john@company.com',
83+
organization: 'Tech Corp'
84+
})}
85+
theme="modern"
86+
size={200}
87+
/>
88+
```
89+
90+
### WiFi Sharing
91+
```javascript
92+
<ReactQrCode
93+
value={QRHelpers.wifi('MyWiFi', 'password123', 'WPA2')}
94+
theme="cyberpunk"
95+
size={200}
96+
/>
97+
```
98+
99+
### Event Invitations
100+
```javascript
101+
<ReactQrCode
102+
value={QRHelpers.event({
103+
summary: 'Team Meeting',
104+
startDate: new Date('2024-03-15T10:00:00'),
105+
location: 'Conference Room A'
106+
})}
107+
theme="nature"
108+
size={200}
109+
/>
110+
```
111+
112+
### Branded QR Codes
113+
```javascript
114+
<AdvancedQRCode
115+
value="https://mycompany.com"
116+
size={300}
117+
advancedStyle={{
118+
eyes: {
119+
frameShape: 'rounded',
120+
frameColor: '#your-brand-color'
121+
},
122+
body: {
123+
shape: 'rounded',
124+
color: '#your-brand-color'
125+
}
126+
}}
127+
imageSettings={{
128+
src: '/logo.png',
129+
excavate: true
130+
}}
131+
/>
132+
```
133+
134+
## 🔧 Development
135+
136+
To run these examples locally with your own modifications:
137+
138+
1. Build the library first:
139+
```bash
140+
cd .. && yarn build
141+
```
142+
143+
2. Open any HTML file in your browser
144+
3. The examples automatically load from `../dist/index.umd.js`
145+
146+
## 🌐 Live Examples
147+
148+
You can run these examples directly in your browser without any setup. Just clone the repository and open the HTML files!
149+
150+
## 📖 Documentation Links
151+
152+
- [Main Repository](https://github.com/devmehq/react-qr-code)
153+
- [NPM Package](https://www.npmjs.com/package/@devmehq/react-qr-code)
154+
- [TypeScript Definitions](../src/types/)
155+
156+
## 🤝 Contributing
157+
158+
Found an example that could be improved or want to add a new use case? Feel free to:
159+
160+
1. Fork the repository
161+
2. Add your example
162+
3. Submit a pull request
163+
164+
## 📄 License
165+
166+
These examples are part of the React QR Code library and are licensed under the same terms as the main library.
167+
168+
---
169+
170+
**Happy coding! 🎉** Start with `index.html` to see the overview, then dive into `advanced-demo.html` for the full feature showcase!

0 commit comments

Comments
 (0)