diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/renderer.rs | 100 |
1 files changed, 66 insertions, 34 deletions
diff --git a/src/renderer.rs b/src/renderer.rs index 7128be4..e419cb0 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -17,6 +17,7 @@ pub fn page( html! { (page_header(page_title)) body { + span #top { } h1 { (page_title) } table { thead { @@ -42,6 +43,9 @@ pub fn page( } } } + a.back href="#top" { + (arrow_up()) + } } } } @@ -79,40 +83,6 @@ fn build_link( } } -/// Partial: new line -fn br() -> Markup { - (PreEscaped("<br>".to_string())) -} - -/// Partial: chevron left -fn chevron_left() -> Markup { - (PreEscaped("◂".to_string())) -} - -/// Partial: chevron up -fn chevron_up() -> Markup { - (PreEscaped("▴".to_string())) -} - -/// Partial: chevron up -fn chevron_down() -> Markup { - (PreEscaped("▾".to_string())) -} - -/// Partial: page header -fn page_header(page_title: &str) -> Markup { - html! { - (DOCTYPE) - html { - meta charset="utf-8"; - meta http-equiv="X-UA-Compatible" content="IE=edge"; - meta name="viewport" content="width=device-width, initial-scale=1"; - title { (page_title) } - style { (css()) } - } - } -} - /// Partial: row for an entry fn entry_row(entry: listing::Entry) -> Markup { html! { @@ -178,6 +148,10 @@ fn entry_row(entry: listing::Entry) -> Markup { /// Partial: CSS fn css() -> Markup { (PreEscaped(r#" + html { + font-smoothing: antialiased; + text-rendering: optimizeLegibility; + } body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,"Helvetica Neue", Helvetica, Arial, sans-serif; @@ -185,6 +159,9 @@ fn css() -> Markup { color: #444444; padding: 0.125rem; } + strong { + font-weight: bold; + } p { margin: 0; padding: 0; @@ -261,6 +238,22 @@ fn css() -> Markup { th span.active a, th span.active span { color: #444444; } + .back { + position: fixed; + bottom: 1.1rem; + right: 0.625rem; + background: #e0e0e0; + border-radius: 100%; + box-shadow: 0 0 8px -4px #888888; + opacity: 0.8; + padding: 1rem 1.1rem; + color: #444444; + } + + .back:hover { + color: #3498db; + text-decoration: none; + } @media (max-width: 600px) { h1 { font-size: 1.375em; @@ -282,6 +275,45 @@ fn css() -> Markup { }"#.to_string())) } +/// Partial: up arrow +fn arrow_up() -> Markup { + (PreEscaped("⇪".to_string())) +} + +/// Partial: new line +fn br() -> Markup { + (PreEscaped("<br>".to_string())) +} + +/// Partial: chevron left +fn chevron_left() -> Markup { + (PreEscaped("◂".to_string())) +} + +/// Partial: chevron up +fn chevron_up() -> Markup { + (PreEscaped("▴".to_string())) +} + +/// Partial: chevron up +fn chevron_down() -> Markup { + (PreEscaped("▾".to_string())) +} + +/// Partial: page header +fn page_header(page_title: &str) -> Markup { + html! { + (DOCTYPE) + html { + meta charset="utf-8"; + meta http-equiv="X-UA-Compatible" content="IE=edge"; + meta name="viewport" content="width=device-width, initial-scale=1"; + title { (page_title) } + style { (css()) } + } + } +} + /// Converts a SystemTime object to a strings tuple (date, time) /// Date is formatted as %e %b, e.g. Jul 12 /// Time is formatted as %R, e.g. 22:34 |