Spaces:
Runtime error
Runtime error
File size: 5,866 Bytes
01fb201 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
# Mobile App Builder Template
A mobile-first template for building cross-platform applications with Next.js 15, TypeScript, and @hanzo/ui components.
## Features
- β¨ Built with **@hanzo/ui** component library (shadcn/ui based)
- π± **Mobile-first** design approach
- π¨ **Monochromatic color scheme** for clean aesthetics
- π **Fully responsive** (mobile, tablet, desktop)
- π **Dark mode** support with next-themes
- π **Next.js 15** App Router with React 19
- π² **Touch-optimized** components
- β‘ **TypeScript strict mode** enabled
- π― **PWA-ready** architecture
## Quick Start
### Installation
```bash
# Install dependencies
npm install
# Start development server
npm run dev
```
Open [http://localhost:3000](http://localhost:3000) on your mobile device or desktop browser.
### Production Build
```bash
# Create production build
npm run build
# Start production server
npm start
```
## Project Structure
```
mobile/
βββ app/ # Next.js App Router
β βββ layout.tsx # Root layout with viewport
β βββ page.tsx # Home page
βββ components/ # React components
β βββ sections/ # Page sections
β βββ hero.tsx # Hero section (mobile-optimized)
β βββ features.tsx # Features grid (touch-friendly)
βββ lib/ # Utilities and config
β βββ site.ts # Site configuration
βββ public/ # Static assets & icons
βββ package.json # Dependencies
```
## Component Usage
All components are imported from `@hanzo/ui` and optimized for mobile:
```tsx
import { Button, Card, CardContent, CardHeader, CardTitle } from '@hanzo/ui/components'
// Mobile-optimized button
<Button size="lg" className="w-full sm:w-auto">
Download App
</Button>
// Touch-friendly card
<Card className="hover:shadow-lg transition-shadow">
<CardHeader>
<CardTitle>Feature</CardTitle>
</CardHeader>
<CardContent>
Mobile-optimized content
</CardContent>
</Card>
```
## Mobile-First Design Patterns
### Responsive Breakpoints
```css
/* Mobile First Approach */
- Base: 320px (minimum mobile)
- sm: 640px (large phones)
- md: 768px (tablets)
- lg: 1024px (desktops)
- xl: 1280px (large screens)
```
### Touch Targets
All interactive elements follow mobile best practices:
- Minimum touch target: 44x44px
- Adequate spacing between tappable elements
- Clear visual feedback on touch
### Mobile Navigation
```tsx
// Example mobile-friendly navigation
<nav className="fixed bottom-0 sm:relative sm:bottom-auto">
{/* Tab bar for mobile, top nav for desktop */}
</nav>
```
## Customization
### Site Configuration
Edit `lib/site.ts` to customize your app details:
```typescript
export const siteConfig = {
name: "Your App Name",
tagline: "Your App Tagline",
description: "What your app does",
url: "https://your-app.com",
features: [
"Feature 1",
"Feature 2",
"Feature 3",
"Feature 4"
]
}
```
### Styling
The template uses a monochromatic color scheme:
- Primary: Black (`#000000`)
- Secondary: Gray (`#666666`)
- Background: White/Dark gray
- Text: High contrast for readability
### Adding Pages
Create mobile-optimized pages:
```tsx
// app/features/page.tsx
import { Button, Card } from '@hanzo/ui/components'
export default function FeaturesPage() {
return (
<div className="container mx-auto py-8 px-4">
<h1 className="text-2xl sm:text-4xl font-bold">
Features
</h1>
{/* Mobile-first content */}
</div>
)
}
```
## Mobile Features
### Progressive Web App (PWA)
- Installable on mobile devices
- Offline capability
- App-like experience
### Touch Gestures
- Swipe navigation support
- Pull-to-refresh patterns
- Smooth scrolling
### Performance Optimization
- Lazy loading for images
- Code splitting by route
- Minimal bundle size
- Optimized for 3G connections
### Device Features
- Responsive viewport meta tag
- Safe area insets for notches
- Orientation change handling
- Native app feel
## Available Scripts
| Command | Description |
|---------|-------------|
| `npm run dev` | Start development server |
| `npm run build` | Build for production |
| `npm start` | Start production server |
| `npm run lint` | Run ESLint |
## Testing on Mobile Devices
### Local Network Testing
```bash
# Start dev server on all network interfaces
npm run dev -- --hostname 0.0.0.0
# Access from mobile device
http://[YOUR_LOCAL_IP]:3000
```
### Mobile Debugging
- Chrome DevTools: Remote debugging for Android
- Safari Web Inspector: iOS debugging
- Responsive Design Mode: Desktop browser testing
## Environment Variables
Create a `.env.local` file:
```env
# Example environment variables
NEXT_PUBLIC_API_URL=https://api.example.com
NEXT_PUBLIC_APP_NAME=MobileFirst
NEXT_PUBLIC_ANALYTICS_ID=UA-...
```
## Responsive Components
All components adapt to screen size:
```tsx
// Responsive grid
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4">
{/* Content */}
</div>
// Responsive typography
<h1 className="text-2xl sm:text-3xl md:text-4xl">
Responsive Heading
</h1>
// Responsive spacing
<div className="p-4 sm:p-6 md:p-8">
{/* Content */}
</div>
```
## TypeScript
Strict mode is enabled for type safety:
```json
{
"compilerOptions": {
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true
}
}
```
## Browser & Device Support
- iOS Safari 13+
- Chrome Mobile 89+
- Samsung Internet 13+
- Firefox Mobile 86+
- Edge Mobile 89+
## Performance Metrics
Target metrics for mobile:
- First Contentful Paint: < 1.8s
- Time to Interactive: < 3.9s
- Cumulative Layout Shift: < 0.1
- Lighthouse Score: > 90
## License
MIT
## Support
For questions or issues, visit [github.com/hanzoai/templates](https://github.com/hanzoai/templates) |