diff --git a/ticker-serve/src/index.rs b/ticker-serve/src/index.rs index 8f8d9d7..85c85ae 100644 --- a/ticker-serve/src/index.rs +++ b/ticker-serve/src/index.rs @@ -1,3 +1,4 @@ +use std::convert::TryInto; use gotham::{ helpers::http::response::create_response, hyper::{Body, Response}, @@ -6,7 +7,7 @@ use gotham::{ use http::status::StatusCode; use mime::TEXT_HTML; -use typed_html::{html, text, dom::DOMTree}; +use typed_html::{html, text, dom::DOMTree, types::{Class, SpacedSet}}; use diesel::prelude::*; use chrono::{offset::Local, Datelike, NaiveDate}; @@ -73,47 +74,52 @@ fn render_index(app_state: &AppState) -> String { - { days.iter().map(|day| html!(
-

- - - { text!("{}", day.date.day()) } - - - { text!("{}", &config.months[day.date.month0() as usize]) } - - - - { text!("{}", &config.weekdays[day.date.weekday().num_days_from_monday() as usize]) } - -

+ { days.iter().map(|day| { + let mut day_class: SpacedSet = ["date"].try_into().unwrap(); + day_class.add(&format!("wd{}", day.date.weekday().num_days_from_monday())[..]); + html!( +
+

+ + + { text!("{}", day.date.day()) } + + + { text!("{}", &config.months[day.date.month0() as usize]) } + + + + { text!("{}", &config.weekdays[day.date.weekday().num_days_from_monday() as usize]) } + +

- { day.events.iter().map(|e| html!( -
- { match &e.url { - None => html!( -

{ text!("{}", &e.summary) }

- ), - Some(url) => html!( -

- - { text!("{}", &e.summary) } - -

- ), - } } + { day.events.iter().map(|e| html!( +
+ { match &e.url { + None => html!( +

{ text!("{}", &e.summary) }

+ ), + Some(url) => html!( +

+ + { text!("{}", &e.summary) } + +

+ ), + } } -

- { text!("{}", &e.dtstart.format("%H:%S")) } -

- { e.location.as_ref().map(|location| html!( -

- { text!("{}", location) } -

- )) } -
- )) } -
)) } +

+ { text!("{}", &e.dtstart.format("%H:%S")) } +

+ { e.location.as_ref().map(|location| html!( +

+ { text!("{}", location) } +

+ )) } + + )) } +
) + }) } ); diff --git a/ticker-serve/static/style.css b/ticker-serve/static/style.css index a91e0bc..564acb9 100644 --- a/ticker-serve/static/style.css +++ b/ticker-serve/static/style.css @@ -23,6 +23,14 @@ h2 { text-align: center; width: 4rem; } +/* saturday */ +.date.wd5 { + color: #999; +} +/* sunday */ +.date.wd6 { + color: #d33; +} .date .day { align-self: center; font-size: 140%; @@ -40,7 +48,7 @@ article { background-color: #f7f7f7; color: #222; margin: 0; - padding: 0.5rem 0 0.5rem 1rem; + padding: 0.8rem 0 0.8rem 1rem; clear: both; line-height: 1.3rem; /*box-shadow: 0 -0.3rem 0.5rem 0.5rem #373737;*/