Skip to content

Commit 522ad70

Browse files
committed
update docs
1 parent 1e065c9 commit 522ad70

File tree

9 files changed

+212
-85
lines changed

9 files changed

+212
-85
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,3 @@ jobs:
3030
cd docs
3131
pnpm install
3232
npm run deploy
33-
34-
# - name: Wrangler Login
35-
# uses: cloudflare/wrangler-action@v3
36-
# with:
37-
# apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
38-
# accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
39-
# workingDirectory: "docs"
40-
# command: "versions"
41-
42-
# - name: Deploy
43-
# env:
44-
# CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
45-
# run: |
46-
# cd docs
47-
# npm run deploy

docs/messages/en.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2+
"language": {
3+
"name": "English"
4+
},
25
"nav": {
36
"features": "Features",
47
"gallery": "Gallery",
@@ -8,8 +11,7 @@
811
"hero": {
912
"title": "Chat Your Way to Amazing Images",
1013
"subtitle": "Simply describe what you want to see, and watch as Typix transforms your words into stunning AI-generated images through natural conversation.",
11-
"primaryBtn": "Try Now",
12-
"secondaryBtn": "View Examples",
14+
"primaryBtn": "TRY NOW",
1315
"stats": {
1416
"images": "Images Created",
1517
"users": "Happy Users",

docs/messages/zh.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2+
"language": {
3+
"name": "中文"
4+
},
25
"nav": {
36
"features": "功能特色",
47
"gallery": "作品画廊",
@@ -9,7 +12,6 @@
912
"title": "通过聊天创造精美图像",
1013
"subtitle": "只需描述您想要看到的内容,观看 Typix 如何通过自然对话将您的文字转化为令人惊叹的 AI 生成图像。",
1114
"primaryBtn": "开始使用",
12-
"secondaryBtn": "查看示例",
1315
"stats": {
1416
"images": "创建图像",
1517
"users": "满意用户",

docs/src/components/footer.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import { useTranslations } from 'next-intl';
44
import { Palette, Github, Twitter, MessageCircle, Sparkles, Zap } from 'lucide-react';
5+
import { TextLinkButton } from './text-link-button';
56

67
export function Footer() {
78
const t = useTranslations('footer');
@@ -71,13 +72,12 @@ export function Footer() {
7172
<ul className="space-y-4">
7273
{links.map((link) => (
7374
<li key={link}>
74-
<a
75+
<TextLinkButton
7576
href={category === 'product' ? `#${link}` : '#'}
76-
className="text-muted-foreground hover:text-foreground transition-all duration-300 micro-interaction relative group"
77+
variant="footer"
7778
>
7879
{link.charAt(0).toUpperCase() + link.slice(1)}
79-
<div className="absolute bottom-0 left-0 w-0 h-px bg-gradient-to-r from-purple-500 via-blue-500 to-cyan-500 group-hover:w-full transition-all duration-300" />
80-
</a>
80+
</TextLinkButton>
8181
</li>
8282
))}
8383
</ul>
@@ -97,14 +97,13 @@ export function Footer() {
9797
</p>
9898
<div className="flex items-center space-x-8 text-sm">
9999
{['Privacy Policy', 'Terms of Service'].map((item) => (
100-
<a
100+
<TextLinkButton
101101
key={item}
102-
href="#"
103-
className="text-muted-foreground hover:text-foreground transition-all duration-300 micro-interaction relative group"
102+
href="#"
103+
variant="footer"
104104
>
105105
{item}
106-
<div className="absolute bottom-0 left-0 w-0 h-px bg-gradient-to-r from-purple-500 via-blue-500 to-cyan-500 group-hover:w-full transition-all duration-300" />
107-
</a>
106+
</TextLinkButton>
108107
))}
109108
</div>
110109
</div>

docs/src/components/header.tsx

Lines changed: 80 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,59 @@
11
'use client';
22

3+
import { useState } from 'react';
34
import { useTranslations } from 'next-intl';
4-
import { Github, ExternalLink } from 'lucide-react';
5+
import { Github, ExternalLink, Menu, X, LucideIcon } from 'lucide-react';
56
import { ThemeToggle } from './theme-toggle';
67
import { LanguageToggle } from './language-toggle';
8+
import { TextLinkButton } from './text-link-button';
9+
10+
// Navigation items configuration
11+
interface NavItem {
12+
key: string;
13+
href: string;
14+
icon: LucideIcon;
15+
external?: boolean;
16+
}
17+
18+
const navigationItems: NavItem[] = [
19+
{
20+
key: 'github',
21+
href: 'https://github.com',
22+
icon: Github,
23+
external: true,
24+
},
25+
{
26+
key: 'docs',
27+
href: '#',
28+
icon: ExternalLink,
29+
external: true,
30+
},
31+
];
732

833
export function Header() {
934
const t = useTranslations('nav');
35+
const [isMenuOpen, setIsMenuOpen] = useState(false);
36+
37+
const toggleMenu = () => {
38+
setIsMenuOpen(!isMenuOpen);
39+
};
40+
41+
const renderNavItem = (item: NavItem, isMobile = false) => {
42+
const label = item.key === 'docs' ? 'Docs' : t(item.key);
43+
44+
return (
45+
<TextLinkButton
46+
key={item.key}
47+
href={item.href}
48+
external={item.external}
49+
variant={isMobile ? 'header-mobile' : 'header-desktop'}
50+
icon={item.icon}
51+
onClick={isMobile ? () => setIsMenuOpen(false) : undefined}
52+
>
53+
{label}
54+
</TextLinkButton>
55+
);
56+
};
1057

1158
return (
1259
<header className="absolute top-0 left-0 right-0 py-6 px-4 sm:px-6 lg:px-8 z-50">
@@ -29,41 +76,44 @@ export function Header() {
2976
</div>
3077
</div>
3178

32-
{/* Right Navigation */}
79+
{/* Right Side */}
3380
<div className="flex items-center space-x-2">
34-
{/* GitHub Link */}
35-
<a
36-
href="https://github.com"
37-
target="_blank"
38-
rel="noopener noreferrer"
39-
className="group flex items-center space-x-2 px-3 py-2 text-sm font-medium text-muted-foreground hover:text-foreground transition-all duration-300 rounded-full border border-border/20 hover:border-border/40 backdrop-blur-sm hover:backdrop-blur-md hover:bg-accent/10"
40-
>
41-
<Github className="w-4 h-4 group-hover:scale-110 transition-transform duration-300" />
42-
<span className="hidden sm:inline">{t('github')}</span>
43-
</a>
44-
45-
{/* Docs Link */}
46-
<a
47-
href="#"
48-
target="_blank"
49-
rel="noopener noreferrer"
50-
className="group flex items-center space-x-2 px-3 py-2 text-sm font-medium text-muted-foreground hover:text-foreground transition-all duration-300 rounded-full border border-border/20 hover:border-border/40 backdrop-blur-sm hover:backdrop-blur-md hover:bg-accent/10"
51-
>
52-
<ExternalLink className="w-4 h-4 group-hover:scale-110 transition-transform duration-300" />
53-
<span className="hidden sm:inline">Docs</span>
54-
</a>
55-
56-
{/* Divider */}
57-
<div className="w-px h-6 bg-border/30 mx-2"></div>
81+
{/* Desktop Navigation */}
82+
<div className="hidden md:flex items-center space-x-2">
83+
{navigationItems.map(item => renderNavItem(item))}
84+
85+
{/* Divider */}
86+
<div className="w-px h-6 bg-border/30 mx-2"></div>
87+
</div>
5888

59-
{/* Theme Toggle */}
89+
{/* Theme and Language Toggles - Always visible */}
6090
<ThemeToggle />
61-
62-
{/* Language Toggle */}
6391
<LanguageToggle />
92+
93+
{/* Mobile Menu Button */}
94+
<button
95+
onClick={toggleMenu}
96+
className="md:hidden p-2 text-muted-foreground hover:text-foreground transition-colors duration-300 rounded-full border border-border/20 hover:border-border/40 backdrop-blur-sm hover:backdrop-blur-md hover:bg-accent/10"
97+
aria-label="Toggle menu"
98+
>
99+
{isMenuOpen ? (
100+
<X className="w-5 h-5" />
101+
) : (
102+
<Menu className="w-5 h-5" />
103+
)}
104+
</button>
64105
</div>
65106
</div>
107+
108+
{/* Mobile Navigation Menu */}
109+
{isMenuOpen && (
110+
<div className="md:hidden mt-4 p-4 rounded-2xl border border-border/20 backdrop-blur-md bg-background/80 shadow-lg">
111+
<div className="flex flex-col space-y-3">
112+
{navigationItems.map(item => renderNavItem(item, true))}
113+
</div>
114+
</div>
115+
)}
66116
</div>
67117
</header>
68118
);
69-
}
119+
}

docs/src/components/hero.tsx

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import { useState, useEffect } from 'react';
55
import { motion, AnimatePresence } from 'motion/react';
66
import {
77
Send,
8-
Sparkles
8+
Sparkles,
9+
Github
910
} from 'lucide-react';
1011

1112
// Simple Typewriter Component
@@ -119,7 +120,7 @@ export function Hero() {
119120

120121
return (
121122
<motion.section
122-
className="pt-48 pb-20 px-4 sm:px-6 lg:px-8 relative overflow-hidden"
123+
className="pt-28 lg:pt-48 pb-20 px-4 sm:px-6 lg:px-8 relative overflow-hidden"
123124
initial={{ opacity: 0 }}
124125
animate={{ opacity: 1 }}
125126
transition={{
@@ -167,15 +168,18 @@ export function Hero() {
167168
{t('subtitle')}
168169
</motion.p>
169170

170-
{/* Single CTA Button */}
171+
{/* CTA Buttons */}
171172
<motion.div
172-
className="flex justify-center lg:justify-start"
173+
className="flex flex-col sm:flex-row gap-4 justify-center lg:justify-start max-w-lg mx-auto lg:mx-0"
173174
initial={{ opacity: 0, y: 20 }}
174175
animate={{ opacity: 1, y: 0 }}
175176
transition={{ duration: 0.6, delay: 0.4 }}
176177
>
177-
<motion.button
178-
className="linear-button text-lg px-8 py-4 glow cursor-pointer"
178+
<motion.a
179+
href="https://app.typix.art"
180+
target="_blank"
181+
className="linear-button px-8 py-5 glow cursor-pointer font-semibold flex-1 inline-flex items-center justify-center"
182+
style={{ fontSize: '1.25rem' }}
179183
whileHover={{
180184
scale: 1.05,
181185
boxShadow: "0 8px 25px rgba(168, 85, 247, 0.4)"
@@ -184,7 +188,22 @@ export function Hero() {
184188
transition={{ duration: 0.3 }}
185189
>
186190
{t('primaryBtn')}
187-
</motion.button>
191+
</motion.a>
192+
193+
<motion.a
194+
href="https://github.com/monkeyWie/typix"
195+
target="_blank"
196+
className="flex items-center justify-center gap-3 text-xl px-8 py-5 bg-card/50 backdrop-blur-sm border border-border/20 rounded-2xl font-semibold text-foreground hover:bg-card/70 transition-all duration-300 flex-1 glow"
197+
whileHover={{
198+
scale: 1.05,
199+
boxShadow: "0 8px 25px rgba(0, 0, 0, 0.1)"
200+
}}
201+
whileTap={{ scale: 0.95 }}
202+
transition={{ duration: 0.3 }}
203+
>
204+
<Github className="w-6 h-6" />
205+
GitHub
206+
</motion.a>
188207
</motion.div>
189208
</motion.div>
190209

docs/src/components/language-toggle.tsx

Lines changed: 41 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,37 @@ import { Languages } from 'lucide-react';
44
import { useRouter, usePathname } from 'next/navigation';
55
import { useLocale } from 'next-intl';
66
import { useState, useEffect } from 'react';
7+
import { locales } from '@/i18n';
8+
9+
// Helper function to get language name from messages
10+
const getLanguageName = async (localeCode: string): Promise<string> => {
11+
try {
12+
const messages = await import(`../../messages/${localeCode}.json`);
13+
return messages.default.language?.name || localeCode;
14+
} catch {
15+
return localeCode;
16+
}
17+
};
718

819
export function LanguageToggle() {
920
const router = useRouter();
1021
const pathname = usePathname();
1122
const locale = useLocale();
1223
const [isOpen, setIsOpen] = useState(false);
1324
const [mounted, setMounted] = useState(false);
25+
const [languageNames, setLanguageNames] = useState<Record<string, string>>({});
1426

15-
// Only enable client-side features after hydration
27+
// Load language names from i18n messages
1628
useEffect(() => {
29+
const loadLanguageNames = async () => {
30+
const names: Record<string, string> = {};
31+
for (const localeCode of locales) {
32+
names[localeCode] = await getLanguageName(localeCode);
33+
}
34+
setLanguageNames(names);
35+
};
36+
37+
loadLanguageNames();
1738
setMounted(true);
1839
}, []);
1940

@@ -31,7 +52,7 @@ export function LanguageToggle() {
3152
<div className="relative">
3253
<button
3354
onClick={() => mounted && setIsOpen(!isOpen)}
34-
className="group w-9 h-9 rounded-full flex items-center justify-center border border-border/20 hover:border-border/40 backdrop-blur-sm hover:backdrop-blur-md hover:bg-accent/10 transition-all duration-300"
55+
className="group w-9 h-9 rounded-full flex items-center justify-center border border-border/20 hover:border-border/40 backdrop-blur-sm hover:backdrop-blur-md hover:bg-accent/10 transition-all duration-300 cursor-pointer disabled:cursor-default"
3556
aria-label="Toggle language"
3657
disabled={!mounted}
3758
>
@@ -44,24 +65,24 @@ export function LanguageToggle() {
4465
className="fixed inset-0 z-10"
4566
onClick={() => setIsOpen(false)}
4667
/>
47-
<div className="absolute right-0 top-full mt-2 w-32 backdrop-blur-md border border-border/30 rounded-xl shadow-2xl z-20 overflow-hidden bg-background/80">
48-
<button
49-
onClick={() => toggleLanguage('en')}
50-
className={`w-full px-4 py-3 text-left text-sm hover:bg-accent/50 transition-all duration-200 ${
51-
locale === 'en' ? 'text-foreground font-medium bg-accent/20' : 'text-muted-foreground'
52-
}`}
53-
>
54-
English
55-
</button>
56-
<div className="w-full h-px bg-border/30"></div>
57-
<button
58-
onClick={() => toggleLanguage('zh')}
59-
className={`w-full px-4 py-3 text-left text-sm hover:bg-accent/50 transition-all duration-200 ${
60-
locale === 'zh' ? 'text-foreground font-medium bg-accent/20' : 'text-muted-foreground'
61-
}`}
62-
>
63-
中文
64-
</button>
68+
<div className="absolute right-0 top-full mt-2 w-32 backdrop-blur-md border border-border/30 rounded-xl shadow-2xl z-20 overflow-hidden bg-background/95">
69+
{locales.map((localeCode, index) => (
70+
<div key={localeCode}>
71+
<button
72+
onClick={() => toggleLanguage(localeCode)}
73+
className={`w-full px-4 py-3 text-left text-sm transition-all duration-200 cursor-pointer hover:bg-slate-100 dark:hover:bg-slate-800 hover:text-slate-900 dark:hover:text-slate-100 ${
74+
locale === localeCode
75+
? 'text-foreground font-semibold bg-slate-200 dark:bg-slate-700'
76+
: 'text-muted-foreground'
77+
}`}
78+
>
79+
{languageNames[localeCode] || localeCode}
80+
</button>
81+
{index < locales.length - 1 && (
82+
<div className="w-full h-px bg-border/30"></div>
83+
)}
84+
</div>
85+
))}
6586
</div>
6687
</>
6788
)}

0 commit comments

Comments
 (0)