From 349f24b76fd3e59df204ad8973a51eb4b74cb65e Mon Sep 17 00:00:00 2001 From: Ruthenic Date: Tue, 14 Mar 2023 17:23:18 -0400 Subject: [PATCH] add bottom of story chapter nav --- css/index.scss | 4 ++++ src/routes/story.rs | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/css/index.scss b/css/index.scss index 45597c3..52182ad 100644 --- a/css/index.scss +++ b/css/index.scss @@ -117,6 +117,10 @@ a:hover { overflow-wrap: anywhere; } +.story-nav { + text-align: center; +} + .not-found-page { margin-top: 0.5em; display: flex; diff --git a/src/routes/story.rs b/src/routes/story.rs index a19f3c3..c359103 100644 --- a/src/routes/story.rs +++ b/src/routes/story.rs @@ -54,6 +54,15 @@ pub async fn render(Query(params): Query) -> Markup { }) { (PreEscaped(paragraph.html)) } } } + div .story-nav { + @if part_idx > 0 { + a href=(format!("/story?id={}&chapter={}", story.id, part_idx-1)) { "<" } + } + " | " + @if part_idx < story._parts.len() - 1 { + a href=(format!("/story?id={}&chapter={}", story.id, part_idx+1)) { ">" } + } + } } } }