From 34155e5c1b208ad989a3de3f09f85fb2a445ee5b Mon Sep 17 00:00:00 2001 From: boasting-squirrel Date: Tue, 26 Feb 2019 23:26:12 +0100 Subject: Stylized table header + added chevrons --- src/renderer.rs | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'src') diff --git a/src/renderer.rs b/src/renderer.rs index 2f25cad..24942d8 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -54,6 +54,7 @@ fn build_link( ) -> Markup { let mut link = format!("?sort={}&order=asc", name); let mut help = format!("Sort by {} in ascending order", name); + let mut chevron = chevron_up(); if let Some(method) = sort_method { if method.to_string() == name { @@ -61,16 +62,52 @@ fn build_link( if order.to_string() == "asc" { link = format!("?sort={}&order=desc", name); help = format!("Sort by {} in descending order", name); + chevron = chevron_down(); } } } }; html! { + (chevron) + a href=(link) title=(help) { (title) } } } +/// Partial: chevron up +fn chevron_up() -> Markup { + let svg = r#" + + + "# + .to_string(); + + (PreEscaped(svg)) +} + +/// Partial: chevron up +fn chevron_down() -> Markup { + let svg = r#" + + + "# + .to_string(); + + (PreEscaped(svg)) +} + /// Partial: page header fn page_header(page_title: &str) -> Markup { html! { @@ -213,6 +250,14 @@ fn css() -> Markup { .mobile-info { display: none; } + th svg { + margin-right: .5rem; + vertical-align: middle; + fill: #777c82; + } + th a, th a:visited { + color: #777c82; + } @media (max-width: 600px) { h1 { font-size: 1.375em; -- cgit v1.2.3