@zoyth/simple-site-framework 1.0.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/LICENSE +21 -0
- package/README.md +572 -0
- package/bin/create-simple-site.js +390 -0
- package/bin/simple-site.js +664 -0
- package/dist/client.js +135 -0
- package/dist/client.js.map +1 -0
- package/dist/client.mjs +107 -0
- package/dist/client.mjs.map +1 -0
- package/dist/components/index.d.mts +3936 -0
- package/dist/components/index.d.ts +3936 -0
- package/dist/components/index.js +38265 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index.mjs +38173 -0
- package/dist/components/index.mjs.map +1 -0
- package/dist/config/index.d.mts +298 -0
- package/dist/config/index.d.ts +298 -0
- package/dist/config/index.js +19 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/index.mjs +1 -0
- package/dist/config/index.mjs.map +1 -0
- package/dist/index.d.mts +2184 -0
- package/dist/index.d.ts +2184 -0
- package/dist/index.js +1713 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1605 -0
- package/dist/index.mjs.map +1 -0
- package/dist/lib/i18n/index.js +665 -0
- package/dist/lib/i18n/index.js.map +1 -0
- package/dist/lib/i18n/index.mjs +621 -0
- package/dist/lib/i18n/index.mjs.map +1 -0
- package/docs/DOCUMENTATION-STRUCTURE.md +1156 -0
- package/docs/EXPORTS.md +125 -0
- package/docs/PERFORMANCE.md +757 -0
- package/docs/POLICY-PAGES.md +867 -0
- package/docs/ROADMAP.md +334 -0
- package/docs/SEO.md +455 -0
- package/docs/SITEMAP.md +708 -0
- package/docs/STRUCTURED-DATA.md +671 -0
- package/docs/accessibility/common-patterns.md +529 -0
- package/docs/accessibility/keyboard-navigation.md +263 -0
- package/docs/accessibility/overview.md +122 -0
- package/docs/accessibility/screen-readers.md +311 -0
- package/docs/accessibility/wcag-compliance.md +159 -0
- package/docs/api/README.md +164 -0
- package/docs/api/components/Accessibility.md +356 -0
- package/docs/api/components/Button.md +240 -0
- package/docs/api/components/HeroSection.md +306 -0
- package/docs/architecture/decisions.md +449 -0
- package/docs/components/AnalyticsTracker.md +58 -0
- package/docs/components/AnimatedCounter.md +48 -0
- package/docs/components/AnimatedSection.md +56 -0
- package/docs/components/BlogCard.md +42 -0
- package/docs/components/Checkbox.md +56 -0
- package/docs/components/CodeBlock.md +52 -0
- package/docs/components/ComparisonTable.md +40 -0
- package/docs/components/ComponentDemo.md +38 -0
- package/docs/components/CountdownTimer.md +51 -0
- package/docs/components/ExitIntentModal.md +56 -0
- package/docs/components/FAQAccordion.md +66 -0
- package/docs/components/FeaturesGrid.md +55 -0
- package/docs/components/FileUpload.md +54 -0
- package/docs/components/I18nMetaTags.md +55 -0
- package/docs/components/Icon.md +53 -0
- package/docs/components/LazySection.md +46 -0
- package/docs/components/LiveProof.md +53 -0
- package/docs/components/LoadingSpinner.md +46 -0
- package/docs/components/MultiStepForm.md +48 -0
- package/docs/components/PolicyLayout.md +55 -0
- package/docs/components/PricingTable.md +49 -0
- package/docs/components/Radio.md +59 -0
- package/docs/components/SEOMetaTags.md +58 -0
- package/docs/components/ScriptInjector.md +50 -0
- package/docs/components/Select.md +72 -0
- package/docs/components/Skeleton.md +47 -0
- package/docs/components/StatsSection.md +48 -0
- package/docs/components/StickyBar.md +62 -0
- package/docs/components/StructuredData.md +99 -0
- package/docs/components/StyleGuide.md +46 -0
- package/docs/components/TableOfContents.md +47 -0
- package/docs/components/TestimonialCarousel.md +42 -0
- package/docs/components/Timeline.md +51 -0
- package/docs/components/Toast.md +59 -0
- package/docs/components/TrackedLink.md +62 -0
- package/docs/components/TrustBadges.md +44 -0
- package/docs/components/conversion/MobileCTA.md +363 -0
- package/docs/components/forms/ContactForm.md +75 -0
- package/docs/components/forms/FormField.md +74 -0
- package/docs/components/layout/Footer.md +601 -0
- package/docs/components/layout/Header.md +549 -0
- package/docs/components/layout/LanguageSelector.md +54 -0
- package/docs/components/layout/LanguageSwitcher.md +24 -0
- package/docs/components/overview.md +447 -0
- package/docs/components/sections/AboutSection.md +48 -0
- package/docs/components/sections/CTASection.md +596 -0
- package/docs/components/sections/CaseStudySection.md +47 -0
- package/docs/components/sections/ContactSection.md +599 -0
- package/docs/components/sections/FeatureSection.md +44 -0
- package/docs/components/sections/HeroSection.md +404 -0
- package/docs/components/sections/LogosSection.md +47 -0
- package/docs/components/sections/PersonalTaxesSection.md +23 -0
- package/docs/components/sections/RecruitingSection.md +23 -0
- package/docs/components/sections/SecurePortalSection.md +23 -0
- package/docs/components/sections/ServicePageLayout.md +52 -0
- package/docs/components/sections/ServicesSection.md +49 -0
- package/docs/components/sections/TestimonialSection.md +44 -0
- package/docs/components/sections/WhyChooseUsSection.md +54 -0
- package/docs/components/ui/Breadcrumb.md +70 -0
- package/docs/components/ui/Button.md +514 -0
- package/docs/components/ui/Card.md +501 -0
- package/docs/components/ui/Input.md +54 -0
- package/docs/components/ui/MobileLinks.md +43 -0
- package/docs/components/ui/Modal.md +60 -0
- package/docs/components/ui/Tabs.md +62 -0
- package/docs/components/ui/Textarea.md +52 -0
- package/docs/core-concepts/configuration-driven.md +552 -0
- package/docs/core-concepts/overview.md +351 -0
- package/docs/features/accessibility/README.md +73 -0
- package/docs/features/accessibility/aria-support.md +177 -0
- package/docs/features/accessibility/color-contrast.md +155 -0
- package/docs/features/accessibility/focus-management.md +187 -0
- package/docs/features/accessibility/testing.md +196 -0
- package/docs/features/analytics/README.md +51 -0
- package/docs/features/analytics/ab-testing.md +171 -0
- package/docs/features/analytics/conversion-tracking.md +207 -0
- package/docs/features/analytics/custom-events.md +219 -0
- package/docs/features/analytics/privacy.md +198 -0
- package/docs/features/analytics/setup.md +114 -0
- package/docs/features/analytics/tracking-events.md +224 -0
- package/docs/features/i18n/README.md +51 -0
- package/docs/features/i18n/best-practices.md +273 -0
- package/docs/features/i18n/configuration.md +84 -0
- package/docs/features/i18n/formatting.md +133 -0
- package/docs/features/i18n/locale-detection.md +122 -0
- package/docs/features/i18n/routing.md +99 -0
- package/docs/features/i18n/rtl-support.md +191 -0
- package/docs/features/i18n/translations.md +129 -0
- package/docs/features/internationalization.md +595 -0
- package/docs/features/performance/README.md +77 -0
- package/docs/features/performance/bundle-size.md +134 -0
- package/docs/features/performance/caching.md +131 -0
- package/docs/features/performance/code-splitting.md +121 -0
- package/docs/features/performance/image-optimization.md +110 -0
- package/docs/features/performance/lazy-loading.md +92 -0
- package/docs/features/performance/monitoring.md +148 -0
- package/docs/features/seo/README.md +51 -0
- package/docs/features/seo/best-practices.md +184 -0
- package/docs/features/seo/canonical-urls.md +182 -0
- package/docs/features/seo/meta-tags.md +126 -0
- package/docs/features/seo/open-graph.md +166 -0
- package/docs/features/seo/robots-txt.md +146 -0
- package/docs/features/seo/sitemaps.md +162 -0
- package/docs/features/seo/structured-data.md +166 -0
- package/docs/getting-started/installation.md +292 -0
- package/docs/getting-started/introduction.md +195 -0
- package/docs/getting-started/quick-start.md +460 -0
- package/docs/guides/analytics-setup.md +616 -0
- package/docs/i18n/CONFIGURATION.md +353 -0
- package/docs/i18n/EXAMPLES.md +402 -0
- package/docs/i18n/MIGRATION.md +260 -0
- package/docs/i18n/SEO.md +392 -0
- package/docs/i18n/STATIC-GENERATION-FIX.md +71 -0
- package/docs/migration/changelog.md +136 -0
- package/docs/migration/overview.md +233 -0
- package/docs/recipes/adding-animations.md +475 -0
- package/docs/recipes/forms-with-validation.md +393 -0
- package/package.json +152 -0
|
@@ -0,0 +1,549 @@
|
|
|
1
|
+
# Header
|
|
2
|
+
|
|
3
|
+
Site navigation component with logo, menu, and CTA button. The persistent top-level navigation for your entire site.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { Header } from '@zoyth/simple-site-framework';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**Type:** Server Component (default export)
|
|
12
|
+
|
|
13
|
+
## Basic Usage
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
<Header
|
|
17
|
+
logo={{
|
|
18
|
+
src: '/logo.svg',
|
|
19
|
+
alt: 'Company Logo',
|
|
20
|
+
width: 150,
|
|
21
|
+
height: 40,
|
|
22
|
+
}}
|
|
23
|
+
navigation={[
|
|
24
|
+
{ label: 'Home', href: '/' },
|
|
25
|
+
{ label: 'About', href: '/about' },
|
|
26
|
+
{ label: 'Services', href: '/services' },
|
|
27
|
+
{ label: 'Contact', href: '/contact' },
|
|
28
|
+
]}
|
|
29
|
+
/>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Props
|
|
33
|
+
|
|
34
|
+
### Required Props
|
|
35
|
+
|
|
36
|
+
| Prop | Type | Description |
|
|
37
|
+
|------|------|-------------|
|
|
38
|
+
| `logo` | `LogoConfig` | Logo configuration |
|
|
39
|
+
| `navigation` | `NavigationItem[]` | Navigation menu items |
|
|
40
|
+
|
|
41
|
+
### Optional Props
|
|
42
|
+
|
|
43
|
+
| Prop | Type | Default | Description |
|
|
44
|
+
|------|------|---------|-------------|
|
|
45
|
+
| `cta` | `CTAConfig` | - | Call-to-action button |
|
|
46
|
+
| `sticky` | `boolean` | `true` | Make header sticky on scroll |
|
|
47
|
+
| `transparent` | `boolean` | `false` | Transparent background |
|
|
48
|
+
| `maxWidth` | `MaxWidth` | `'7xl'` | Maximum content width |
|
|
49
|
+
| `className` | `string` | - | Custom CSS classes |
|
|
50
|
+
| `locale` | `string` | - | Current locale |
|
|
51
|
+
|
|
52
|
+
### Type Definitions
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
interface LogoConfig {
|
|
56
|
+
src: string;
|
|
57
|
+
alt: string;
|
|
58
|
+
width: number;
|
|
59
|
+
height: number;
|
|
60
|
+
href?: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
interface NavigationItem {
|
|
64
|
+
label: string | LocalizedString;
|
|
65
|
+
href: string;
|
|
66
|
+
children?: NavigationItem[];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
interface CTAConfig {
|
|
70
|
+
text: string | LocalizedString;
|
|
71
|
+
href: string;
|
|
72
|
+
onClick?: () => void;
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Examples
|
|
77
|
+
|
|
78
|
+
### Simple Header
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
<Header
|
|
82
|
+
logo={{
|
|
83
|
+
src: '/logo.svg',
|
|
84
|
+
alt: 'Acme Corp',
|
|
85
|
+
width: 120,
|
|
86
|
+
height: 32,
|
|
87
|
+
}}
|
|
88
|
+
navigation={[
|
|
89
|
+
{ label: 'Home', href: '/' },
|
|
90
|
+
{ label: 'About', href: '/about' },
|
|
91
|
+
{ label: 'Contact', href: '/contact' },
|
|
92
|
+
]}
|
|
93
|
+
/>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### With CTA Button
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
<Header
|
|
100
|
+
logo={{
|
|
101
|
+
src: '/logo.svg',
|
|
102
|
+
alt: 'Acme Corp',
|
|
103
|
+
width: 120,
|
|
104
|
+
height: 32,
|
|
105
|
+
}}
|
|
106
|
+
navigation={[
|
|
107
|
+
{ label: 'Features', href: '/features' },
|
|
108
|
+
{ label: 'Pricing', href: '/pricing' },
|
|
109
|
+
{ label: 'About', href: '/about' },
|
|
110
|
+
]}
|
|
111
|
+
cta={{
|
|
112
|
+
text: 'Start Free Trial',
|
|
113
|
+
href: '/signup',
|
|
114
|
+
}}
|
|
115
|
+
/>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### With Dropdown Menu
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
<Header
|
|
122
|
+
logo={{
|
|
123
|
+
src: '/logo.svg',
|
|
124
|
+
alt: 'Acme Corp',
|
|
125
|
+
width: 120,
|
|
126
|
+
height: 32,
|
|
127
|
+
}}
|
|
128
|
+
navigation={[
|
|
129
|
+
{ label: 'Home', href: '/' },
|
|
130
|
+
{
|
|
131
|
+
label: 'Services',
|
|
132
|
+
href: '/services',
|
|
133
|
+
children: [
|
|
134
|
+
{ label: 'Web Development', href: '/services/web' },
|
|
135
|
+
{ label: 'Mobile Apps', href: '/services/mobile' },
|
|
136
|
+
{ label: 'Consulting', href: '/services/consulting' },
|
|
137
|
+
],
|
|
138
|
+
},
|
|
139
|
+
{ label: 'About', href: '/about' },
|
|
140
|
+
{ label: 'Contact', href: '/contact' },
|
|
141
|
+
]}
|
|
142
|
+
/>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Multi-Language Header
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
<Header
|
|
149
|
+
logo={{
|
|
150
|
+
src: '/logo.svg',
|
|
151
|
+
alt: 'Acme Corp',
|
|
152
|
+
width: 120,
|
|
153
|
+
height: 32,
|
|
154
|
+
}}
|
|
155
|
+
navigation={[
|
|
156
|
+
{
|
|
157
|
+
label: { en: 'Home', fr: 'Accueil', es: 'Inicio' },
|
|
158
|
+
href: '/',
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
label: { en: 'About', fr: 'À propos', es: 'Acerca de' },
|
|
162
|
+
href: '/about',
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
label: { en: 'Contact', fr: 'Contact', es: 'Contacto' },
|
|
166
|
+
href: '/contact',
|
|
167
|
+
},
|
|
168
|
+
]}
|
|
169
|
+
cta={{
|
|
170
|
+
text: {
|
|
171
|
+
en: 'Get Started',
|
|
172
|
+
fr: 'Commencer',
|
|
173
|
+
es: 'Empezar',
|
|
174
|
+
},
|
|
175
|
+
href: '/signup',
|
|
176
|
+
}}
|
|
177
|
+
locale={locale}
|
|
178
|
+
/>
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Transparent Header
|
|
182
|
+
|
|
183
|
+
```typescript
|
|
184
|
+
<Header
|
|
185
|
+
transparent
|
|
186
|
+
logo={{
|
|
187
|
+
src: '/logo-white.svg',
|
|
188
|
+
alt: 'Acme Corp',
|
|
189
|
+
width: 120,
|
|
190
|
+
height: 32,
|
|
191
|
+
}}
|
|
192
|
+
navigation={[
|
|
193
|
+
{ label: 'Home', href: '/' },
|
|
194
|
+
{ label: 'About', href: '/about' },
|
|
195
|
+
]}
|
|
196
|
+
className="text-white"
|
|
197
|
+
/>
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Non-Sticky Header
|
|
201
|
+
|
|
202
|
+
```typescript
|
|
203
|
+
<Header
|
|
204
|
+
sticky={false}
|
|
205
|
+
logo={{
|
|
206
|
+
src: '/logo.svg',
|
|
207
|
+
alt: 'Acme Corp',
|
|
208
|
+
width: 120,
|
|
209
|
+
height: 32,
|
|
210
|
+
}}
|
|
211
|
+
navigation={[
|
|
212
|
+
{ label: 'Home', href: '/' },
|
|
213
|
+
{ label: 'About', href: '/about' },
|
|
214
|
+
]}
|
|
215
|
+
/>
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Custom Logo Link
|
|
219
|
+
|
|
220
|
+
```typescript
|
|
221
|
+
<Header
|
|
222
|
+
logo={{
|
|
223
|
+
src: '/logo.svg',
|
|
224
|
+
alt: 'Acme Corp',
|
|
225
|
+
width: 120,
|
|
226
|
+
height: 32,
|
|
227
|
+
href: '/dashboard', // Go to dashboard instead of home
|
|
228
|
+
}}
|
|
229
|
+
navigation={[
|
|
230
|
+
{ label: 'Projects', href: '/projects' },
|
|
231
|
+
{ label: 'Settings', href: '/settings' },
|
|
232
|
+
]}
|
|
233
|
+
/>
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## Styling
|
|
237
|
+
|
|
238
|
+
### Custom Background
|
|
239
|
+
|
|
240
|
+
```typescript
|
|
241
|
+
<Header
|
|
242
|
+
logo={logoConfig}
|
|
243
|
+
navigation={navItems}
|
|
244
|
+
className="bg-gradient-to-r from-blue-600 to-purple-600 text-white"
|
|
245
|
+
/>
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Custom Height
|
|
249
|
+
|
|
250
|
+
```typescript
|
|
251
|
+
<Header
|
|
252
|
+
logo={logoConfig}
|
|
253
|
+
navigation={navItems}
|
|
254
|
+
className="h-20" // Taller header
|
|
255
|
+
/>
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### Custom Max Width
|
|
259
|
+
|
|
260
|
+
```typescript
|
|
261
|
+
<Header
|
|
262
|
+
logo={logoConfig}
|
|
263
|
+
navigation={navItems}
|
|
264
|
+
maxWidth="full" // Full width instead of constrained
|
|
265
|
+
/>
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### Dark Mode
|
|
269
|
+
|
|
270
|
+
```typescript
|
|
271
|
+
<Header
|
|
272
|
+
logo={logoConfig}
|
|
273
|
+
navigation={navItems}
|
|
274
|
+
className="dark:bg-gray-900 dark:text-white"
|
|
275
|
+
/>
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## Mobile Navigation
|
|
279
|
+
|
|
280
|
+
The Header component automatically adapts for mobile:
|
|
281
|
+
|
|
282
|
+
- **Desktop:** Horizontal menu with all items visible
|
|
283
|
+
- **Mobile:** Hamburger menu with slide-out drawer
|
|
284
|
+
- **Breakpoint:** Responsive at `md` (768px)
|
|
285
|
+
|
|
286
|
+
### Mobile Menu Behavior
|
|
287
|
+
|
|
288
|
+
- Hamburger icon appears on mobile
|
|
289
|
+
- Tapping opens full-screen menu
|
|
290
|
+
- Dropdowns expand inline
|
|
291
|
+
- CTA button remains visible
|
|
292
|
+
- Smooth animations
|
|
293
|
+
|
|
294
|
+
## Accessibility
|
|
295
|
+
|
|
296
|
+
Header includes:
|
|
297
|
+
|
|
298
|
+
- ✅ Semantic `<header>` and `<nav>` elements
|
|
299
|
+
- ✅ Proper heading hierarchy (logo as h1 alternative)
|
|
300
|
+
- ✅ Keyboard navigation (Tab, Enter, Escape)
|
|
301
|
+
- ✅ ARIA labels for mobile menu toggle
|
|
302
|
+
- ✅ Focus trap in mobile menu
|
|
303
|
+
- ✅ Skip link target
|
|
304
|
+
- ✅ Screen reader announcements for menu state
|
|
305
|
+
|
|
306
|
+
### ARIA Attributes
|
|
307
|
+
|
|
308
|
+
```typescript
|
|
309
|
+
// Mobile menu button automatically includes:
|
|
310
|
+
<button
|
|
311
|
+
aria-label="Open navigation menu"
|
|
312
|
+
aria-expanded={isOpen}
|
|
313
|
+
aria-controls="mobile-menu"
|
|
314
|
+
>
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
## Common Patterns
|
|
318
|
+
|
|
319
|
+
### Site-Wide Header
|
|
320
|
+
|
|
321
|
+
```typescript
|
|
322
|
+
// src/app/layout.tsx
|
|
323
|
+
import { Header } from '@zoyth/simple-site-framework';
|
|
324
|
+
import { siteConfig } from '@/config/site';
|
|
325
|
+
import { navigation } from '@/config/navigation';
|
|
326
|
+
|
|
327
|
+
export default function RootLayout({ children }) {
|
|
328
|
+
return (
|
|
329
|
+
<html>
|
|
330
|
+
<body>
|
|
331
|
+
<Header
|
|
332
|
+
logo={siteConfig.logo}
|
|
333
|
+
navigation={navigation}
|
|
334
|
+
cta={{
|
|
335
|
+
text: 'Get Started',
|
|
336
|
+
href: '/signup',
|
|
337
|
+
}}
|
|
338
|
+
/>
|
|
339
|
+
{children}
|
|
340
|
+
</body>
|
|
341
|
+
</html>
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### Locale-Aware Header
|
|
347
|
+
|
|
348
|
+
```typescript
|
|
349
|
+
// src/app/[locale]/layout.tsx
|
|
350
|
+
import { Header } from '@zoyth/simple-site-framework';
|
|
351
|
+
import { navigation } from '@/config/navigation';
|
|
352
|
+
|
|
353
|
+
export default function LocaleLayout({ params: { locale } }) {
|
|
354
|
+
return (
|
|
355
|
+
<>
|
|
356
|
+
<Header
|
|
357
|
+
logo={logoConfig}
|
|
358
|
+
navigation={navigation}
|
|
359
|
+
locale={locale}
|
|
360
|
+
>
|
|
361
|
+
<LanguageSelector currentLocale={locale} />
|
|
362
|
+
</Header>
|
|
363
|
+
{/* ... */}
|
|
364
|
+
</>
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
### Header with Search
|
|
370
|
+
|
|
371
|
+
```typescript
|
|
372
|
+
<Header
|
|
373
|
+
logo={logoConfig}
|
|
374
|
+
navigation={navItems}
|
|
375
|
+
cta={{
|
|
376
|
+
text: 'Sign In',
|
|
377
|
+
href: '/login',
|
|
378
|
+
}}
|
|
379
|
+
>
|
|
380
|
+
<div className="flex items-center gap-4">
|
|
381
|
+
<input
|
|
382
|
+
type="search"
|
|
383
|
+
placeholder="Search..."
|
|
384
|
+
className="px-4 py-2 border rounded-lg"
|
|
385
|
+
/>
|
|
386
|
+
<Button variant="filled">Search</Button>
|
|
387
|
+
</div>
|
|
388
|
+
</Header>
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
### Authenticated Header
|
|
392
|
+
|
|
393
|
+
```typescript
|
|
394
|
+
function AuthenticatedHeader({ user }) {
|
|
395
|
+
return (
|
|
396
|
+
<Header
|
|
397
|
+
logo={logoConfig}
|
|
398
|
+
navigation={[
|
|
399
|
+
{ label: 'Dashboard', href: '/dashboard' },
|
|
400
|
+
{ label: 'Projects', href: '/projects' },
|
|
401
|
+
{ label: 'Settings', href: '/settings' },
|
|
402
|
+
]}
|
|
403
|
+
cta={
|
|
404
|
+
user ? {
|
|
405
|
+
text: user.name,
|
|
406
|
+
href: '/profile',
|
|
407
|
+
} : {
|
|
408
|
+
text: 'Sign In',
|
|
409
|
+
href: '/login',
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
/>
|
|
413
|
+
);
|
|
414
|
+
}
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
## Integration
|
|
418
|
+
|
|
419
|
+
### With Language Selector
|
|
420
|
+
|
|
421
|
+
```typescript
|
|
422
|
+
import { Header, LanguageSelector } from '@zoyth/simple-site-framework';
|
|
423
|
+
|
|
424
|
+
<Header
|
|
425
|
+
logo={logoConfig}
|
|
426
|
+
navigation={navItems}
|
|
427
|
+
>
|
|
428
|
+
<LanguageSelector currentLocale={locale} />
|
|
429
|
+
</Header>
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
### With Analytics
|
|
433
|
+
|
|
434
|
+
```typescript
|
|
435
|
+
<Header
|
|
436
|
+
logo={logoConfig}
|
|
437
|
+
navigation={navItems}
|
|
438
|
+
cta={{
|
|
439
|
+
text: 'Start Trial',
|
|
440
|
+
href: '/signup',
|
|
441
|
+
onClick: () => {
|
|
442
|
+
trackEvent('header_cta_click', {
|
|
443
|
+
location: 'header',
|
|
444
|
+
text: 'Start Trial',
|
|
445
|
+
});
|
|
446
|
+
},
|
|
447
|
+
}}
|
|
448
|
+
/>
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
### With Active Link Highlighting
|
|
452
|
+
|
|
453
|
+
```typescript
|
|
454
|
+
'use client';
|
|
455
|
+
|
|
456
|
+
import { usePathname } from 'next/navigation';
|
|
457
|
+
import { Header } from '@zoyth/simple-site-framework';
|
|
458
|
+
|
|
459
|
+
export function ActiveHeader() {
|
|
460
|
+
const pathname = usePathname();
|
|
461
|
+
|
|
462
|
+
return (
|
|
463
|
+
<Header
|
|
464
|
+
logo={logoConfig}
|
|
465
|
+
navigation={navItems.map(item => ({
|
|
466
|
+
...item,
|
|
467
|
+
active: pathname === item.href,
|
|
468
|
+
}))}
|
|
469
|
+
/>
|
|
470
|
+
);
|
|
471
|
+
}
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
## Best Practices
|
|
475
|
+
|
|
476
|
+
### ✅ Do
|
|
477
|
+
|
|
478
|
+
- Keep navigation menu concise (5-7 top-level items max)
|
|
479
|
+
- Use descriptive labels (not "Click Here")
|
|
480
|
+
- Make CTA button prominent and action-oriented
|
|
481
|
+
- Use sticky header for better navigation access
|
|
482
|
+
- Test mobile menu on actual devices
|
|
483
|
+
- Ensure logo is optimized for fast loading
|
|
484
|
+
|
|
485
|
+
### ❌ Don't
|
|
486
|
+
|
|
487
|
+
- Overcrowd navigation with too many items
|
|
488
|
+
- Hide important pages in dropdowns
|
|
489
|
+
- Make logo too large (affects mobile)
|
|
490
|
+
- Use tiny text (accessibility issue)
|
|
491
|
+
- Forget to test keyboard navigation
|
|
492
|
+
- Make mobile menu hard to close
|
|
493
|
+
|
|
494
|
+
## Troubleshooting
|
|
495
|
+
|
|
496
|
+
### Logo not displaying
|
|
497
|
+
|
|
498
|
+
**Check:**
|
|
499
|
+
1. Image path is correct (relative to `public/` folder)
|
|
500
|
+
2. Image file exists
|
|
501
|
+
3. Width and height are provided
|
|
502
|
+
4. Image format is supported
|
|
503
|
+
|
|
504
|
+
### Mobile menu not working
|
|
505
|
+
|
|
506
|
+
**Check:**
|
|
507
|
+
1. JavaScript is enabled
|
|
508
|
+
2. Mobile menu component is client-rendered
|
|
509
|
+
3. No CSS hiding the menu
|
|
510
|
+
4. Z-index is sufficient
|
|
511
|
+
|
|
512
|
+
### Navigation items not clickable
|
|
513
|
+
|
|
514
|
+
**Check:**
|
|
515
|
+
1. `href` is provided for each item
|
|
516
|
+
2. No overlay blocking clicks
|
|
517
|
+
3. Links are not disabled
|
|
518
|
+
4. Z-index conflicts resolved
|
|
519
|
+
|
|
520
|
+
### Sticky header not sticking
|
|
521
|
+
|
|
522
|
+
**Check:**
|
|
523
|
+
1. `sticky` prop is `true` (default)
|
|
524
|
+
2. No parent element with `overflow: hidden`
|
|
525
|
+
3. CSS not overriding `position: sticky`
|
|
526
|
+
|
|
527
|
+
## SEO
|
|
528
|
+
|
|
529
|
+
- Uses semantic `<header>` and `<nav>` tags
|
|
530
|
+
- Logo includes proper alt text
|
|
531
|
+
- Navigation is crawlable (real `<a>` tags)
|
|
532
|
+
- Mobile menu doesn't block content from crawlers
|
|
533
|
+
|
|
534
|
+
## Performance
|
|
535
|
+
|
|
536
|
+
- Server component by default (no JavaScript)
|
|
537
|
+
- Logo uses Next.js `<Image>` for optimization
|
|
538
|
+
- Mobile menu lazy-loaded on mobile
|
|
539
|
+
- Minimal CSS bundle
|
|
540
|
+
|
|
541
|
+
## Related Components
|
|
542
|
+
|
|
543
|
+
- **[Footer](./Footer.md)** - Site footer
|
|
544
|
+
- **[LanguageSelector](./LanguageSelector.md)** - Language switcher
|
|
545
|
+
- **[Button](../ui/Button.md)** - CTA button component
|
|
546
|
+
|
|
547
|
+
## API Reference
|
|
548
|
+
|
|
549
|
+
Full TypeScript definitions: **[API Reference](../../api/components.md#header)**
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# LanguageSelector
|
|
2
|
+
|
|
3
|
+
Adaptive language switcher (toggle or dropdown based on language count).
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { LanguageSelector } from '@zoyth/simple-site-framework';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**Type:** Client Component
|
|
12
|
+
|
|
13
|
+
## Basic Usage
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
<LanguageSelector
|
|
17
|
+
currentLocale={locale}
|
|
18
|
+
variant="auto"
|
|
19
|
+
/>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Props
|
|
23
|
+
|
|
24
|
+
| Prop | Type | Required | Description |
|
|
25
|
+
|------|------|----------|-------------|
|
|
26
|
+
| `currentLocale` | `string` | Yes | Current locale |
|
|
27
|
+
| `variant` | `'auto' \| 'text' \| 'dropdown'` | No | Selector variant (default: 'auto') |
|
|
28
|
+
| `className` | `string` | No | Custom classes |
|
|
29
|
+
|
|
30
|
+
## Variants
|
|
31
|
+
|
|
32
|
+
- `auto` - Automatically chooses: text toggle for 2 languages, dropdown for 3+
|
|
33
|
+
- `text` - Simple text toggle (best for 2 languages)
|
|
34
|
+
- `dropdown` - Dropdown menu (best for 3+ languages)
|
|
35
|
+
|
|
36
|
+
## Examples
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
// Auto-detect variant
|
|
40
|
+
<LanguageSelector currentLocale="en" />
|
|
41
|
+
|
|
42
|
+
// Force dropdown
|
|
43
|
+
<LanguageSelector currentLocale="en" variant="dropdown" />
|
|
44
|
+
|
|
45
|
+
// In header
|
|
46
|
+
<Header logo={logo} navigation={nav}>
|
|
47
|
+
<LanguageSelector currentLocale={locale} />
|
|
48
|
+
</Header>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## See Also
|
|
52
|
+
|
|
53
|
+
- [Header](./Header.md)
|
|
54
|
+
- [Internationalization Guide](../../features/internationalization.md)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# LanguageSwitcher
|
|
2
|
+
|
|
3
|
+
**⚠️ DEPRECATED:** Use [LanguageSelector](./LanguageSelector.md) instead.
|
|
4
|
+
|
|
5
|
+
## Deprecation Notice
|
|
6
|
+
|
|
7
|
+
This component is deprecated and maintained only for backward compatibility. It will be removed in a future major version.
|
|
8
|
+
|
|
9
|
+
**Migration:** Replace `LanguageSwitcher` with `LanguageSelector`:
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
// Old (deprecated)
|
|
13
|
+
import { LanguageSwitcher } from '@zoyth/simple-site-framework';
|
|
14
|
+
<LanguageSwitcher currentLocale={locale} />
|
|
15
|
+
|
|
16
|
+
// New (recommended)
|
|
17
|
+
import { LanguageSelector } from '@zoyth/simple-site-framework';
|
|
18
|
+
<LanguageSelector currentLocale={locale} />
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## See Also
|
|
22
|
+
|
|
23
|
+
- [LanguageSelector](./LanguageSelector.md) - Recommended replacement
|
|
24
|
+
- [Internationalization Guide](../../features/internationalization.md)
|