Skip to content

Commit 0efe6e5

Browse files
jsollycursoragent
andauthored
fix(chapter): lay out Previous/Next as back-forward pair (#46)
Put adjacent-chapter controls on one row — Previous left, Next right — so chapter paging reads as left/right movement. Keep Check your knowledge and Browse chapters as full-width actions above/below. Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: John Solly <jsolly@users.noreply.github.com>
1 parent 6ad6f51 commit 0efe6e5

1 file changed

Lines changed: 32 additions & 23 deletions

File tree

src/components/app/ChapterView.svelte

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -243,43 +243,52 @@
243243
/>
244244
</p>
245245
{/if}
246-
<div
247-
class={`${chapter.closing ? "mt-6" : ""} flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center`}
248-
>
246+
<div class={`${chapter.closing ? "mt-6" : ""} flex flex-col gap-3`}>
249247
{#if showChapterQuiz}
250248
<Button
251249
size="lg"
252-
class="w-full sm:h-11 sm:min-w-[12rem] sm:flex-1 sm:text-base"
250+
class="w-full sm:h-11 sm:text-base"
253251
onclick={() => game.runChapterQuizAction(chapter.quizCta.action)}
254252
>
255253
{chapter.quizCta.label}
256254
</Button>
257255
{/if}
258256
{#if game.chapterKind === "shelf-chapter"}
259-
{#if prevChapter}
260-
<Button
261-
size="lg"
262-
variant="outline"
263-
class="w-full sm:h-11 sm:min-w-[12rem] sm:flex-1 sm:text-base"
264-
href={learnChapterPath(prevChapter.unitId, prevChapter.id)}
265-
>
266-
Previous chapter
267-
</Button>
268-
{/if}
269-
{#if nextChapter}
270-
<Button
271-
size="lg"
272-
variant="outline"
273-
class="w-full sm:h-11 sm:min-w-[12rem] sm:flex-1 sm:text-base"
274-
href={learnChapterPath(nextChapter.unitId, nextChapter.id)}
257+
{#if prevChapter || nextChapter}
258+
<nav
259+
class="flex items-center gap-4"
260+
aria-label="Adjacent chapters"
275261
>
276-
Next chapter
277-
</Button>
262+
<div class="flex min-w-0 flex-1 justify-start">
263+
{#if prevChapter}
264+
<Button
265+
size="sm"
266+
variant="outline"
267+
class="px-3"
268+
href={learnChapterPath(prevChapter.unitId, prevChapter.id)}
269+
>
270+
← Previous
271+
</Button>
272+
{/if}
273+
</div>
274+
<div class="flex min-w-0 flex-1 justify-end">
275+
{#if nextChapter}
276+
<Button
277+
size="sm"
278+
variant="outline"
279+
class="px-3"
280+
href={learnChapterPath(nextChapter.unitId, nextChapter.id)}
281+
>
282+
Next →
283+
</Button>
284+
{/if}
285+
</div>
286+
</nav>
278287
{/if}
279288
<Button
280289
size="lg"
281290
variant="outline"
282-
class="w-full sm:h-11 sm:min-w-[12rem] sm:flex-1 sm:text-base"
291+
class="w-full sm:h-11 sm:text-base"
283292
href={learnShelfPath(chapter.unitId)}
284293
>
285294
Browse chapters

0 commit comments

Comments
 (0)