Skip to content

Commit 9de1413

Browse files
authored
Merge pull request #15 from grayhatdevelopers/demo
feat: Add context-aware job application form example with AI suggestions
2 parents af09c4a + e5e3a4e commit 9de1413

35 files changed

+3422
-1
lines changed

demo/.gitignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
.env
15+
16+
# Editor directories and files
17+
.vscode/*
18+
!.vscode/extensions.json
19+
.idea
20+
.DS_Store
21+
*.suo
22+
*.ntvs*
23+
*.njsproj
24+
*.sln
25+
*.sw?

demo/FEATURES.md

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
# Demo Site Features
2+
3+
## Pages
4+
5+
### 1. Home Page (`/`)
6+
- **Hero Section**: Eye-catching gradient hero with animated elements
7+
- **Features Grid**: 6 feature cards highlighting key capabilities
8+
- **Code Example**: Syntax-highlighted quick start example
9+
- **CTA Section**: Call-to-action with links to get started
10+
- **Responsive Design**: Mobile-first, fully responsive layout
11+
12+
### 2. Get Started Page (`/get-started`)
13+
- **Installation Guide**: Multiple package manager options (npm, pnpm, yarn)
14+
- **Basic Usage**: Copy-paste ready code examples
15+
- **Provider Configuration**: Multi-provider setup examples
16+
- **Chrome AI Setup**: Detailed requirements and setup instructions
17+
- **Next Steps**: Links to examples and documentation
18+
- **Copy to Clipboard**: One-click code copying functionality
19+
20+
### 3. Examples Overview (`/examples`)
21+
- **Example Cards**: Grid of available examples with difficulty levels
22+
- **Quick Navigation**: Direct links to each example
23+
- **Categorization**: Beginner, Intermediate, and Advanced examples
24+
25+
### 4. Example Pages
26+
27+
#### Basic Autofill (`/examples/basic`)
28+
- **Live Form**: Interactive contact form with AI autofill
29+
- **Code Example**: Side-by-side implementation code
30+
- **How It Works**: Step-by-step explanation
31+
- **Form Validation**: React Hook Form validation in action
32+
33+
#### Field Suggestions (`/examples/field-suggestions`)
34+
- **Individual Field AI**: Sparkle button for each field
35+
- **Accept/Dismiss UI**: User-controlled suggestion acceptance
36+
- **Context-Aware**: AI considers other field values
37+
- **Custom Debounce**: Faster suggestions (500ms)
38+
- **Visual Feedback**: Loading states and suggestion cards
39+
40+
#### Multi-Provider Setup (`/examples/multi-provider`)
41+
- **Provider Configuration**: Chrome AI, OpenAI, Custom server
42+
- **Automatic Fallback**: Graceful degradation demo
43+
- **Error Handling**: User-friendly error messages
44+
- **Status Indicators**: Success/failure feedback
45+
- **Priority System**: Visual explanation of provider order
46+
47+
#### Chrome AI Download (`/examples/chrome-ai`)
48+
- **Status Monitoring**: Real-time AI availability checking
49+
- **Progress Tracking**: Download progress bar
50+
- **Status Icons**: Visual indicators for each state
51+
- **Requirements Guide**: Detailed Chrome AI setup
52+
- **Polling System**: Automatic status refresh during download
53+
54+
## UI Components (shadcn/ui)
55+
56+
### Implemented Components
57+
- **Button**: Multiple variants (default, outline, ghost, link)
58+
- **Card**: Container with header, content, footer sections
59+
- **Input**: Styled text input with focus states
60+
- **Label**: Form labels with proper accessibility
61+
- **Textarea**: Multi-line text input
62+
- **Progress**: (Implicit in download tracking)
63+
64+
### Component Features
65+
- **Accessibility**: ARIA labels, keyboard navigation
66+
- **Dark Mode Ready**: CSS variables for theming
67+
- **Responsive**: Mobile-first design
68+
- **Customizable**: Tailwind CSS classes
69+
- **Type Safe**: Full TypeScript support
70+
71+
## Design System
72+
73+
### Colors
74+
- **Primary**: Blue gradient (blue-600 to purple-600)
75+
- **Secondary**: Muted gray tones
76+
- **Accent**: Feature-specific colors (green, yellow, orange, pink)
77+
- **Semantic**: Success (green), Warning (yellow), Error (red)
78+
79+
### Typography
80+
- **Headings**: Bold, tracking-tight
81+
- **Body**: Readable, muted-foreground for secondary text
82+
- **Code**: Monospace with muted background
83+
84+
### Spacing
85+
- **Container**: Max-width with responsive padding
86+
- **Sections**: Consistent vertical rhythm (py-20, py-32)
87+
- **Components**: Tailwind spacing scale
88+
89+
### Layout
90+
- **Header**: Sticky navigation with backdrop blur
91+
- **Footer**: Minimal with credits and license
92+
- **Grid**: Responsive grid layouts (1, 2, 3 columns)
93+
- **Cards**: Consistent padding and spacing
94+
95+
## Interactive Features
96+
97+
### AI Functionality
98+
- **Autofill Button**: One-click form population
99+
- **Field Suggestions**: Per-field AI assistance
100+
- **Loading States**: Visual feedback during AI operations
101+
- **Error Handling**: Graceful error messages
102+
- **Availability Checking**: Real-time AI status
103+
104+
### User Experience
105+
- **Copy to Clipboard**: Code examples with copy button
106+
- **Visual Feedback**: Success/error states with icons
107+
- **Progress Indicators**: Download progress bars
108+
- **Responsive Navigation**: Mobile-friendly menu
109+
- **Smooth Transitions**: CSS transitions for interactions
110+
111+
### Navigation
112+
- **React Router**: Client-side routing
113+
- **Active Links**: Visual indication of current page
114+
- **External Links**: Open in new tab with security
115+
- **Breadcrumbs**: (Implicit through page titles)
116+
117+
## Technical Features
118+
119+
### Performance
120+
- **Code Splitting**: Route-based splitting
121+
- **Tree Shaking**: Unused code removal
122+
- **Minification**: Production build optimization
123+
- **Asset Optimization**: Optimized images and fonts
124+
125+
### SEO
126+
- **Meta Tags**: Title, description for each page
127+
- **Semantic HTML**: Proper heading hierarchy
128+
- **robots.txt**: Search engine instructions
129+
- **Sitemap**: (Can be added)
130+
131+
### Accessibility
132+
- **ARIA Labels**: Screen reader support
133+
- **Keyboard Navigation**: Full keyboard support
134+
- **Focus States**: Visible focus indicators
135+
- **Color Contrast**: WCAG AA compliant
136+
137+
### Developer Experience
138+
- **TypeScript**: Full type safety
139+
- **Hot Module Replacement**: Instant updates
140+
- **ESLint**: Code quality checks
141+
- **Prettier**: Code formatting
142+
- **VS Code Integration**: IntelliSense support
143+
144+
## Links & Resources
145+
146+
### Header Links
147+
- **NPM**: Link to package on npmjs.com
148+
- **GitHub**: Link to repository
149+
- **Discord**: Link to community (placeholder)
150+
151+
### Footer Links
152+
- **Author Credits**: Links to contributors' GitHub profiles
153+
- **License**: MIT license information
154+
155+
### Internal Navigation
156+
- **Get Started**: Installation and setup
157+
- **Examples**: Interactive demos
158+
- **Home**: Landing page
159+
160+
## Responsive Breakpoints
161+
162+
- **Mobile**: < 768px (1 column layouts)
163+
- **Tablet**: 768px - 1024px (2 column layouts)
164+
- **Desktop**: > 1024px (3 column layouts)
165+
- **Large Desktop**: > 1400px (max container width)
166+
167+
## Browser Support
168+
169+
- **Modern Browsers**: Chrome, Firefox, Safari, Edge (latest 2 versions)
170+
- **Chrome AI**: Chrome 139+ (Canary/Dev) for AI features
171+
- **Mobile Browsers**: iOS Safari, Chrome Mobile
172+
173+
## Future Enhancements
174+
175+
Potential additions:
176+
- **Search Functionality**: Search examples and docs
177+
- **Theme Switcher**: Light/dark mode toggle
178+
- **More Examples**: Advanced use cases
179+
- **Video Tutorials**: Embedded video guides
180+
- **Playground**: Interactive code editor
181+
- **API Reference**: Detailed API documentation
182+
- **Blog**: Articles and tutorials
183+
- **Changelog**: Version history

demo/README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# React Hook Form AI - Demo Site
2+
3+
Interactive demo and documentation site for [react-hook-form-ai](https://github.com/grayhatdevelopers/react-hook-form-ai).
4+
5+
## Features
6+
7+
- 🎨 Built with shadcn/ui components
8+
- 📱 Fully responsive design
9+
- 🚀 Multiple interactive examples
10+
- 📖 Comprehensive documentation
11+
- 🎯 Hosted on GitHub Pages
12+
13+
## Development
14+
15+
```bash
16+
# Install dependencies
17+
npm install
18+
19+
# Start development server
20+
npm run dev
21+
22+
# Build for production
23+
npm run build
24+
25+
# Preview production build
26+
npm run preview
27+
```
28+
29+
## Deployment
30+
31+
Deploy the site to GitHub Pages:
32+
33+
```bash
34+
npm run deploy
35+
```
36+
37+
This will:
38+
1. Build the production bundle
39+
2. Deploy to the `gh-pages` branch
40+
3. Make it available at: https://grayhatdevelopers.github.io/react-hook-form-ai/
41+
42+
## Examples Included
43+
44+
1. **Basic Autofill** - Simple form with AI autofill button
45+
2. **Field Suggestions** - Individual field AI suggestions with accept/dismiss UI
46+
3. **Multi-Provider Setup** - Multiple AI providers with automatic fallback
47+
4. **Chrome AI Download** - Handle Chrome AI model download with progress tracking
48+
49+
## Tech Stack
50+
51+
- React 18
52+
- TypeScript
53+
- Vite
54+
- Tailwind CSS
55+
- shadcn/ui
56+
- React Router
57+
- react-hook-form-ai
58+
59+
## License
60+
61+
MIT

demo/eslint.config.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import js from '@eslint/js'
2+
import globals from 'globals'
3+
import reactHooks from 'eslint-plugin-react-hooks'
4+
import reactRefresh from 'eslint-plugin-react-refresh'
5+
import tseslint from 'typescript-eslint'
6+
import { defineConfig, globalIgnores } from 'eslint/config'
7+
8+
export default defineConfig([
9+
globalIgnores(['dist']),
10+
{
11+
files: ['**/*.{ts,tsx}'],
12+
extends: [
13+
js.configs.recommended,
14+
tseslint.configs.recommended,
15+
reactHooks.configs['recommended-latest'],
16+
reactRefresh.configs.vite,
17+
],
18+
languageOptions: {
19+
ecmaVersion: 2020,
20+
globals: globals.browser,
21+
},
22+
},
23+
])

demo/index.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta
6+
http-equiv="origin-trial"
7+
content="%VITE_ORIGIN_TRIAL_TOKEN%"
8+
/>
9+
<link rel="icon" type="image/svg+xml" href="/logo.svg" />
10+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
11+
<meta name="description" content="React Hook Form AI - AI-powered form autofill and suggestions for React" />
12+
<title>React Hook Form AI - AI-Powered Forms</title>
13+
</head>
14+
<body>
15+
<div id="root"></div>
16+
<script type="module" src="/src/main.tsx"></script>
17+
</body>
18+
</html>

demo/package.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "react-hook-form-ai-demo",
3+
"version": "1.0.0",
4+
"private": true,
5+
"type": "module",
6+
"scripts": {
7+
"dev": "vite",
8+
"build": "tsc && vite build",
9+
"preview": "vite preview"
10+
},
11+
"dependencies": {
12+
"class-variance-authority": "^0.7.0",
13+
"clsx": "^2.1.1",
14+
"lucide-react": "^0.441.0",
15+
"react": "^17.0.2",
16+
"react-dom": "^17.0.2",
17+
"react-hook-form-ai": "^1.0.6",
18+
"react-router-dom": "^6.26.0",
19+
"shiki": "^3.15.0",
20+
"tailwind-merge": "^2.5.2"
21+
},
22+
"devDependencies": {
23+
"@tailwindcss/vite": "^4.1.17",
24+
"@types/node": "^24.10.1",
25+
"@types/react": "^18.3.5",
26+
"@types/react-dom": "^18.3.0",
27+
"@vitejs/plugin-react": "^4.3.1",
28+
"gh-pages": "^6.3.0",
29+
"tailwindcss": "^4.1.17",
30+
"typescript": "^5.5.3",
31+
"vite": "^5.4.3"
32+
}
33+
}

demo/public/404.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<script>
6+
const pathname = location.pathname;
7+
const hasExtension = /\.[^\/]+$/.test(pathname);
8+
9+
// Only redirect SPA routes (no extension)
10+
if (!hasExtension) {
11+
const redirectUrl = encodeURIComponent(pathname + location.search);
12+
13+
// Redirect exactly once into SPA entry
14+
location.replace("/react-hook-form-ai/index.html?redirect=" + redirectUrl);
15+
}
16+
</script>
17+
<title>404</title>
18+
</head>
19+
<body>
20+
<h1>404</h1>
21+
</body>
22+
</html>

0 commit comments

Comments
 (0)