|
23 | 23 | $: expanded_chapter = current.chapter.slug; |
24 | 24 | </script> |
25 | 25 |
|
| 26 | +<svelte:window on:keydown={(e) => e.key === 'Escape' && (is_open = false)} /> |
| 27 | + |
26 | 28 | <div |
27 | 29 | class="container" |
28 | 30 | class:dark={$theme.current === 'dark'} |
|
38 | 40 | <Icon name="arrow-left" size={16} /> |
39 | 41 | </a> |
40 | 42 |
|
41 | | - <button |
42 | | - class="heading" |
43 | | - on:click={() => ($is_mobile ? open_nav() : (is_open = !is_open))} |
44 | | - class:open={is_open} |
45 | | - > |
46 | | - <h1> |
47 | | - <div class="mobile"> |
48 | | - <div class="heading-row"> |
49 | | - <strong>{current.title}</strong> |
50 | | - </div> |
51 | | - <div class="heading-row"> |
52 | | - <span class="part-title">{current.part.label}</span> |
53 | | - <span class="separator">/</span> |
54 | | - <span class="chapter-title">{current.chapter.title}</span> |
| 43 | + <div class="menu" class:open={is_open}> |
| 44 | + <button on:click={() => ($is_mobile ? open_nav() : (is_open = !is_open))}> |
| 45 | + <h1> |
| 46 | + <div class="mobile"> |
| 47 | + <div class="heading-row"> |
| 48 | + <strong>{current.title}</strong> |
| 49 | + </div> |
| 50 | + <div class="heading-row"> |
| 51 | + <span class="part-title">{current.part.label}</span> |
| 52 | + <span class="separator">/</span> |
| 53 | + <span class="chapter-title">{current.chapter.title}</span> |
| 54 | + </div> |
55 | 55 | </div> |
56 | | - </div> |
57 | 56 |
|
58 | | - <div class="desktop"> |
59 | | - <span class="part-title">{current.part.title}</span><span class="separator">/</span> |
60 | | - <span class="chapter-title">{current.chapter.title}</span><span class="separator">/</span |
61 | | - ><strong>{current.title}</strong> |
62 | | - </div> |
| 57 | + <div class="desktop"> |
| 58 | + <span class="part-title">{current.part.title}</span><span class="separator">/</span> |
| 59 | + <span class="chapter-title">{current.chapter.title}</span><span class="separator">/</span |
| 60 | + ><strong>{current.title}</strong> |
| 61 | + </div> |
63 | 62 |
|
64 | | - <span style="flex: 1 1 auto"></span> |
65 | | - </h1> |
| 63 | + <span style="flex: 1 1 auto"></span> |
| 64 | + </h1> |
66 | 65 |
|
67 | | - <span class="expand-icon" class:inverted={is_open}> |
68 | | - <Icon name="chevron-down" /> |
69 | | - </span> |
| 66 | + <span class="expand-icon" class:inverted={is_open}> |
| 67 | + <Icon name="chevron-down" /> |
| 68 | + </span> |
| 69 | + </button> |
70 | 70 |
|
71 | 71 | {#if is_open} |
72 | 72 | <nav |
|
140 | 140 | </div> |
141 | 141 | </nav> |
142 | 142 | {/if} |
143 | | - </button> |
| 143 | + </div> |
144 | 144 |
|
145 | 145 | <a |
146 | 146 | class="next-button" |
|
191 | 191 | width: 100%; |
192 | 192 | } |
193 | 193 |
|
194 | | - .heading.open { |
| 194 | + .menu.open { |
195 | 195 | border-radius: var(--sk-border-radius) var(--sk-border-radius) 0 0; |
196 | 196 | } |
197 | 197 |
|
|
200 | 200 | font-size: var(--sk-text-xs); |
201 | 201 | } |
202 | 202 |
|
203 | | - .heading { |
| 203 | + .menu { |
204 | 204 | font-size: var(--sk-text-s); |
205 | 205 | border: none; |
206 | 206 | } |
|
209 | 209 | color: var(--sk-theme-1); |
210 | 210 | } |
211 | 211 |
|
212 | | - .heading { |
| 212 | + .menu { |
213 | 213 | flex: 1; |
214 | 214 |
|
215 | 215 | position: relative; |
216 | 216 |
|
217 | | - display: flex; |
218 | | - justify-content: center; |
219 | | - align-items: center; |
220 | | - gap: 0.4ch; |
221 | | -
|
222 | 217 | top: 0.15rem; |
223 | 218 | height: 100%; |
224 | 219 | min-width: 0; |
|
238 | 233 | cursor: pointer; |
239 | 234 | } |
240 | 235 |
|
| 236 | + .menu > button { |
| 237 | + display: flex; |
| 238 | + justify-content: center; |
| 239 | + align-items: center; |
| 240 | + gap: 0.4ch; |
| 241 | + width: 100%; |
| 242 | + height: 100%; |
| 243 | + } |
| 244 | +
|
241 | 245 | h1 { |
242 | 246 | display: flex; |
243 | 247 |
|
|
414 | 418 | } |
415 | 419 |
|
416 | 420 | /* Remove all styles */ |
417 | | - .heading { |
| 421 | + .menu { |
418 | 422 | box-shadow: none; |
419 | 423 | background-color: transparent; |
420 | 424 |
|
|
0 commit comments