Skip to content

Commit 371386f

Browse files
committed
fix: adjust letter-spacing and layout in CSS components for improved readability
1 parent 3aef106 commit 371386f

3 files changed

Lines changed: 29 additions & 27 deletions

File tree

src/app/globals.css

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ body {
3232
-webkit-font-smoothing: antialiased;
3333
-moz-osx-font-smoothing: grayscale;
3434
text-rendering: optimizeLegibility;
35-
letter-spacing: -0.01em;
35+
letter-spacing: 0;
3636
}
3737

3838
body {
@@ -59,7 +59,7 @@ html {
5959

6060
@layer base {
6161
h1, h2, h3, h4 {
62-
letter-spacing: -0.022em;
62+
letter-spacing: 0;
6363
font-feature-settings: 'ss01';
6464
}
6565
h1 { font-weight: 700; }
@@ -131,15 +131,15 @@ html {
131131
}
132132
.section-heading {
133133
@apply text-3xl font-semibold tracking-tight text-[color:var(--fg-primary)] md:text-4xl;
134-
letter-spacing: -0.028em;
134+
letter-spacing: 0;
135135
}
136136
.section-subheading {
137137
@apply mt-3 max-w-2xl text-[15px] leading-relaxed text-[color:var(--fg-secondary)] md:text-base;
138138
}
139139
.display-title {
140-
@apply text-4xl font-bold tracking-tight sm:text-5xl md:text-6xl lg:text-7xl;
141-
letter-spacing: -0.035em;
142-
line-height: 1.04;
140+
@apply text-[34px] font-bold tracking-tight sm:text-5xl md:text-6xl lg:text-7xl;
141+
letter-spacing: 0;
142+
line-height: 1.08;
143143
}
144144
.focus-ring {
145145
@apply focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--accent)] focus-visible:ring-offset-2 focus-visible:ring-offset-[color:var(--surface)];

src/components/NavBar.tsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export function NavBar({ locale, dict }: Props) {
1919
const pathname = usePathname() ?? '/';
2020
const [scrolled, setScrolled] = useState(false);
2121
const [open, setOpen] = useState(false);
22+
const brandLabel = locale === 'zh' ? dict.meta.siteName : 'Codex Tutorial';
2223

2324
useEffect(() => {
2425
const onScroll = () => setScrolled(window.scrollY > 8);
@@ -52,26 +53,27 @@ export function NavBar({ locale, dict }: Props) {
5253
<header
5354
className={cn(
5455
'sticky top-0 z-50 transition-all duration-500',
55-
scrolled ? 'pt-2' : 'pt-4'
56+
scrolled ? 'pt-2' : 'pt-3 sm:pt-4'
5657
)}
5758
>
58-
<div className="mx-auto max-w-6xl px-4 sm:px-6 lg:px-8">
59+
<div className="mx-auto max-w-6xl px-3 sm:px-6 lg:px-8">
5960
<nav
6061
className={cn(
61-
'flex items-center justify-between gap-4 rounded-full border border-[color:var(--line)] backdrop-blur-2xl transition-all duration-500',
62+
'flex items-center justify-between gap-2 rounded-[28px] border border-[color:var(--line)] backdrop-blur-2xl transition-all duration-500 sm:rounded-full sm:gap-4',
6263
scrolled
6364
? 'bg-white/80 shadow-soft px-3 py-2'
64-
: 'bg-white/60 px-4 py-2.5'
65+
: 'bg-white/60 px-3 py-2.5 sm:px-4'
6566
)}
6667
aria-label={locale === 'zh' ? '主导航' : 'Primary navigation'}
6768
>
6869
<Link
6970
href={localePath(locale)}
70-
className="focus-ring flex items-center gap-2 rounded-full pl-1 pr-3 py-1"
71+
aria-label={dict.meta.siteName}
72+
className="focus-ring flex min-w-0 flex-1 items-center gap-2 rounded-full py-1 pl-1 pr-2 sm:flex-none sm:pr-3"
7173
>
72-
<CodexLogo size={28} />
73-
<span className="hidden text-[13px] font-semibold tracking-tight text-ink sm:inline">
74-
{dict.meta.siteName}
74+
<CodexLogo size={28} className="shrink-0" />
75+
<span className="min-w-0 truncate text-[12px] font-semibold text-ink sm:text-[13px]">
76+
{brandLabel}
7577
</span>
7678
</Link>
7779

@@ -93,8 +95,8 @@ export function NavBar({ locale, dict }: Props) {
9395
))}
9496
</ul>
9597

96-
<div className="flex items-center gap-2">
97-
<LanguageSwitcher currentLocale={locale} compact />
98+
<div className="flex shrink-0 items-center gap-1.5 sm:gap-2">
99+
<LanguageSwitcher currentLocale={locale} compact className="px-2.5 sm:px-3" />
98100
<Link
99101
href={localePath(locale, 'generator')}
100102
className="focus-ring hidden rounded-full bg-ink px-3.5 py-1.5 text-[13px] font-semibold text-white shadow-soft transition hover:-translate-y-0.5 sm:inline-flex"

src/components/home/HomeSections.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,18 @@ type Props = { locale: Locale; dict: Dictionary };
2424

2525
export function HomeHero({ locale, dict }: Props) {
2626
return (
27-
<section className="relative overflow-hidden px-4 pb-20 pt-12 sm:px-6 md:pb-28 md:pt-16 lg:px-8">
27+
<section className="relative overflow-hidden px-4 pb-16 pt-10 sm:px-6 sm:pb-20 sm:pt-12 md:pb-28 md:pt-16 lg:px-8">
2828
<div className="mx-auto max-w-5xl">
29-
<div className="mb-6 flex items-center justify-center">
29+
<div className="mb-5 flex items-center justify-center sm:mb-6">
3030
<span className="chip-accent">
3131
<SparkleIcon size={12} />
3232
{dict.home.heroEyebrow}
3333
</span>
3434
</div>
3535

36-
<h1 className="display-title text-balance text-center text-ink">
36+
<h1 className="display-title mx-auto max-w-[13em] text-balance text-center text-ink sm:max-w-none">
3737
{dict.home.heroTitleLine1}
38-
<span className="mx-2 inline-block align-baseline text-ink/90">
38+
<span className="mx-1 inline-block align-baseline text-ink/90 sm:mx-2">
3939
{dict.home.heroTitleHighlight}
4040
</span>
4141
<br />
@@ -44,16 +44,16 @@ export function HomeHero({ locale, dict }: Props) {
4444
</span>
4545
</h1>
4646

47-
<p className="mx-auto mt-6 max-w-2xl text-balance text-center text-[16px] leading-relaxed text-ink-soft md:text-[17px]">
47+
<p className="mx-auto mt-5 max-w-2xl text-balance text-center text-[15px] leading-relaxed text-ink-soft sm:mt-6 md:text-[17px]">
4848
{dict.home.heroSubtitle}
4949
</p>
5050

51-
<div className="mt-8 flex flex-wrap items-center justify-center gap-3">
52-
<LinkButton href={localePath(locale, 'generator')} variant="primary" size="lg">
51+
<div className="mt-7 flex flex-col items-center justify-center gap-3 min-[430px]:flex-row sm:mt-8">
52+
<LinkButton href={localePath(locale, 'generator')} variant="primary" size="lg" className="w-full max-w-[280px] min-[430px]:w-auto">
5353
{dict.home.heroCtaPrimary}
5454
<ArrowRightIcon size={16} />
5555
</LinkButton>
56-
<LinkButton href={localePath(locale, 'guide')} variant="glass" size="lg">
56+
<LinkButton href={localePath(locale, 'guide')} variant="glass" size="lg" className="w-full max-w-[280px] min-[430px]:w-auto">
5757
{dict.home.heroCtaSecondary}
5858
</LinkButton>
5959
</div>
@@ -69,11 +69,11 @@ export function HomeHero({ locale, dict }: Props) {
6969
</span>
7070
</div>
7171

72-
<div className="relative mt-16 md:mt-20">
72+
<div className="relative mt-10 sm:mt-16 md:mt-20">
7373
<HeroVisual locale={locale} />
7474
</div>
7575

76-
<div className="mt-12 grid grid-cols-1 gap-3 sm:grid-cols-3">
76+
<div className="mt-10 grid grid-cols-1 gap-3 sm:mt-12 sm:grid-cols-3">
7777
<StatCard value={dict.home.heroStatsValue1} label={dict.home.heroStatsLabel1} />
7878
<StatCard value={dict.home.heroStatsValue2} label={dict.home.heroStatsLabel2} />
7979
<StatCard value={dict.home.heroStatsValue3} label={dict.home.heroStatsLabel3} />
@@ -86,7 +86,7 @@ export function HomeHero({ locale, dict }: Props) {
8686
function StatCard({ value, label }: { value: string; label: string }) {
8787
return (
8888
<div className="rounded-[22px] border border-[color:var(--line)] bg-white/70 px-6 py-5 text-center backdrop-blur-xl">
89-
<div className="text-[28px] font-semibold tracking-tight text-ink md:text-[32px]" style={{ letterSpacing: '-0.02em' }}>
89+
<div className="text-[28px] font-semibold text-ink md:text-[32px]">
9090
{value}
9191
</div>
9292
<div className="mt-1 text-[12px] uppercase tracking-wider text-ink-mute">{label}</div>

0 commit comments

Comments
 (0)