Skip to content

Commit 6e092a3

Browse files
committed
Added blog
1 parent 510e64e commit 6e092a3

3 files changed

Lines changed: 174 additions & 136 deletions

File tree

src/components/Navbar.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,22 @@ import { useLanguage } from '../contexts/LanguageContext';
33

44
interface NavbarProps {
55
logoSrc?: string;
6+
forceTheme?: 'default' | 'cyan' | 'redstone';
67
}
78

8-
export function Navbar({ logoSrc = `${import.meta.env.BASE_URL}images/logo 1.PNG` }: NavbarProps) {
9+
export function Navbar({ logoSrc = `${import.meta.env.BASE_URL}images/logo 1.PNG`, forceTheme }: NavbarProps) {
910
const { lang, setLang, t } = useLanguage();
1011
const [scrolled, setScrolled] = useState(false);
11-
const [currentTheme, setCurrentTheme] = useState<'default' | 'cyan' | 'redstone'>('default');
12+
const [currentTheme, setCurrentTheme] = useState<'default' | 'cyan' | 'redstone'>(forceTheme || 'default');
1213
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
1314

1415
useEffect(() => {
1516
const handleScroll = () => {
1617
setScrolled(window.scrollY > 50);
1718

19+
// Skip theme detection if forceTheme is set
20+
if (forceTheme) return;
21+
1822
const navbarHeight = 80;
1923

2024
// Check sections in order of priority
@@ -40,7 +44,7 @@ export function Navbar({ logoSrc = `${import.meta.env.BASE_URL}images/logo 1.PNG
4044
window.addEventListener('scroll', handleScroll);
4145
handleScroll(); // Initial check
4246
return () => window.removeEventListener('scroll', handleScroll);
43-
}, []);
47+
}, [forceTheme]);
4448

4549
const themeClass = currentTheme !== 'default' ? `${currentTheme}-theme` : '';
4650

src/index.css

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3183,13 +3183,19 @@ ul {
31833183
padding: 0 var(--space-md) var(--space-xl);
31843184
}
31853185

3186+
/* Header Row: Back Button + Language Toggle */
3187+
.blog-header-row {
3188+
display: flex;
3189+
align-items: center;
3190+
justify-content: space-between;
3191+
margin-bottom: var(--space-md);
3192+
}
3193+
31863194
/* Language Toggle */
31873195
.blog-lang-toggle {
31883196
display: flex;
31893197
align-items: center;
3190-
justify-content: flex-end;
31913198
gap: 0.25rem;
3192-
margin-bottom: var(--space-sm);
31933199
}
31943200

31953201
.blog-lang-toggle button {
@@ -3219,19 +3225,26 @@ ul {
32193225
}
32203226

32213227
/* Chinese Language Specific Styles */
3222-
.lang-zh .blog-hero h1,
3223-
.lang-zh .blog-section h2,
3224-
.lang-zh .blog-toc h2 {
3225-
font-family: 'ChenYuluoyan', 'Noto Serif TC', serif;
3228+
/* Main title uses ChenYuluoyan */
3229+
.lang-zh .blog-hero h1 {
3230+
font-family: 'ChenYuluoyan', 'Noto Sans TC', sans-serif;
32263231
font-weight: 400;
32273232
letter-spacing: 0.05em;
32283233
}
32293234

3235+
/* Section headings use Noto Sans TC */
3236+
.lang-zh .blog-section h2,
3237+
.lang-zh .blog-toc h2 {
3238+
font-family: 'Noto Sans TC', sans-serif;
3239+
font-weight: 700;
3240+
letter-spacing: 0.02em;
3241+
}
3242+
32303243
.lang-zh .blog-section h3,
32313244
.lang-zh .blog-card h4,
32323245
.lang-zh .credits-grid h4 {
3233-
font-family: 'ChenYuluoyan', 'Noto Serif TC', serif;
3234-
font-weight: 400;
3246+
font-family: 'Noto Sans TC', sans-serif;
3247+
font-weight: 600;
32353248
}
32363249

32373250
.lang-zh .blog-section p,
@@ -3247,6 +3260,7 @@ ul {
32473260
}
32483261

32493262
/* English Language Specific Styles */
3263+
32503264
.lang-en .blog-section p,
32513265
.lang-en .blog-list li,
32523266
.lang-en .blog-step>div,
@@ -3255,7 +3269,7 @@ ul {
32553269
.lang-en .blog-subtitle,
32563270
.lang-en .blog-lead,
32573271
.lang-en .blog-figure figcaption {
3258-
font-family: 'Noto Serif', serif;
3272+
font-family: 'Inter', 'Noto Serif', serif;
32593273
}
32603274

32613275
/* Back Button */
@@ -3270,7 +3284,6 @@ ul {
32703284
border: 1px solid rgba(255, 255, 255, 0.15);
32713285
border-radius: 8px;
32723286
transition: all 0.2s ease;
3273-
margin-bottom: var(--space-md);
32743287
}
32753288

32763289
.blog-back-btn:hover {

0 commit comments

Comments
 (0)