Skip to content

Commit e59a101

Browse files
committed
Make buttons smaller for chapter pages
1 parent f43f9dd commit e59a101

3 files changed

Lines changed: 39 additions & 32 deletions

File tree

‎ui/src/components/chapter/ChapterNav.astro‎

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ const {
2424
const t = useTranslations(activeLang);
2525
---
2626

27-
<nav class="chapter-nav" aria-label="Chapter navigation">
27+
<nav class="chapter-nav" aria-label="Chapter">
2828
{isFirstChapter ? (
2929
<a href={`/ultimate-python/${activeLang}/`} class="chapter-nav-btn prev">
3030
<span class="nav-direction">
31-
<ChevronLeft size={14} />
31+
<ChevronLeft size={14} aria-hidden="true" />
3232
<span>{t('nav.home')}</span>
3333
</span>
3434
<span class="nav-title">{t('site.title')}</span>
@@ -39,7 +39,7 @@ const t = useTranslations(activeLang);
3939
class="chapter-nav-btn prev"
4040
>
4141
<span class="nav-direction">
42-
<ChevronLeft size={14} />
42+
<ChevronLeft size={14} aria-hidden="true" />
4343
<span>{t('chapter.prev')}</span>
4444
</span>
4545
<span class="nav-title">{prevChapter.name}</span>
@@ -55,7 +55,7 @@ const t = useTranslations(activeLang);
5555
>
5656
<span class="nav-direction">
5757
<span>{t('chapter.next')}</span>
58-
<ChevronRight size={14} />
58+
<ChevronRight size={14} aria-hidden="true" />
5959
</span>
6060
<span class="nav-title">{nextChapter.name}</span>
6161
</a>
@@ -68,63 +68,73 @@ const t = useTranslations(activeLang);
6868
.chapter-nav {
6969
display: flex;
7070
justify-content: space-between;
71-
gap: 1.5rem;
72-
padding-top: 2.5rem;
71+
gap: 1rem;
72+
padding-top: 2rem;
7373
border-top: 1px solid var(--border-color);
74-
margin-top: 3.5rem;
74+
margin-top: 1rem;
7575
width: 100%;
7676
}
7777

7878
.chapter-nav-btn {
7979
display: flex;
8080
flex-direction: column;
81-
padding: 1rem 1.35rem;
82-
border-radius: 8px;
81+
padding: 0.55rem 1rem;
82+
border-radius: 6px;
8383
background-color: var(--bg-secondary);
8484
border: 1px solid var(--border-color);
8585
color: var(--text-primary);
8686
transition:
8787
transform var(--transition-speed),
8888
border-color var(--transition-speed),
89+
background-color var(--transition-speed),
8990
box-shadow var(--transition-speed);
90-
min-width: 180px;
91-
max-width: 48%;
91+
min-width: 140px;
92+
max-width: 45%;
9293
text-decoration: none;
9394
}
9495

95-
.chapter-nav-btn:hover {
96+
.chapter-nav-btn:hover,
97+
.chapter-nav-btn:focus-visible {
9698
background-color: var(--bg-tertiary);
9799
border-color: var(--forest-green);
98-
transform: translateY(-2px);
100+
transform: translateY(-1px);
99101
box-shadow: 0 4px 12px rgba(27, 67, 50, 0.08);
100102
}
101103

104+
.chapter-nav-btn:focus-visible {
105+
outline: 2px solid var(--forest-green);
106+
outline-offset: 2px;
107+
}
108+
102109
.chapter-nav-btn.next {
103110
margin-left: auto;
104111
align-items: flex-end;
105112
text-align: right;
106113
}
107114

108115
.nav-direction {
109-
font-size: 0.75rem;
116+
font-size: 0.68rem;
110117
color: var(--text-secondary);
111118
text-transform: uppercase;
112119
letter-spacing: 0.05em;
113120
font-family: var(--font-sans);
114121
margin-bottom: 0.35rem;
122+
line-height: 1.2;
115123
display: inline-flex;
116124
align-items: center;
117125
gap: 0.35rem;
118126
font-weight: 500;
119127
}
120128

121-
.chapter-nav-btn:hover .nav-direction {
129+
.chapter-nav-btn:hover .nav-direction,
130+
.chapter-nav-btn:focus-visible .nav-direction {
122131
color: var(--forest-green);
123132
}
124133

125134
.nav-title {
126-
font-size: 1.05rem;
135+
font-size: 0.88rem;
127136
font-weight: 600;
137+
line-height: 1.3;
128138
color: var(--forest-green);
129139
font-family: var(--font-serif);
130140
white-space: nowrap;
@@ -139,20 +149,17 @@ const t = useTranslations(activeLang);
139149

140150
@media (width <= 640px) {
141151
.chapter-nav {
142-
flex-direction: column;
143-
gap: 1rem;
144-
padding-top: 1.5rem;
145-
margin-top: 2rem;
152+
padding-top: 1.25rem;
153+
gap: 0.5rem;
146154
}
147155

148156
.chapter-nav-btn {
149-
max-width: 100%;
150-
width: 100%;
157+
padding: 0.5rem 0.75rem;
158+
min-width: 120px;
151159
}
152160

153-
.chapter-nav-btn.next {
154-
align-items: flex-start;
155-
text-align: left;
161+
.nav-title {
162+
font-size: 0.82rem;
156163
}
157164
}
158165
</style>

‎ui/src/pages/[lang]/[category]/index.astro‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ const firstLesson = categoryLessons[0];
222222
.lessons-section {
223223
display: flex;
224224
flex-direction: column;
225-
gap: 1.75rem;
225+
gap: 2rem;
226226
}
227227

228228
.section-header {

‎ui/src/pages/[lang]/index.astro‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,16 @@ const totalLessons = lessons.length;
117117
}
118118

119119
h1 {
120-
font-size: clamp(2rem, 4vw, 2.35rem);
121-
line-height: 1.25;
120+
font-size: clamp(2.2rem, 4.5vw, 2.75rem);
121+
line-height: 1.2;
122122
margin-top: 0.5rem;
123123
letter-spacing: -0.01em;
124124
}
125125

126126
.subtitle {
127-
font-size: 1.05rem;
127+
font-size: 1.125rem;
128128
color: var(--text-secondary);
129-
line-height: 1.6;
129+
line-height: 1.65;
130130
}
131131

132132
.cta-group {
@@ -181,11 +181,11 @@ const totalLessons = lessons.length;
181181
}
182182

183183
h1 {
184-
font-size: 1.75rem;
184+
font-size: 1.95rem;
185185
}
186186

187187
.subtitle {
188-
font-size: 0.95rem;
188+
font-size: 1rem;
189189
}
190190

191191
.cta-group {

0 commit comments

Comments
 (0)