use crate::page; use crate::story; use maud::{html, Markup}; use serde::Deserialize; #[derive(Deserialize)] pub struct Data { pub stories: Vec, } impl page::Page for Data { fn page_title() -> String { String::from("Home") } fn alternative_htmlfilename() -> Option { Some(String::from("index")) } fn render_content(&self) -> Markup { let last_story = self.stories.first(); html!( @if let Some(story) = last_story { div class="latest-story" lang=(story.html_lang_value()) { h2 lang="en" { "Latest Story" } h3 { (story.name) } @if let Some(content_warnings) = story.render_content_warnings() { (content_warnings) } p { (story.description) } ul lang="en" { li { "Language: " (story.language) } li { a href=(&story.format_pdf_path()) download { "PDF" } } } } } ) } fn content_style() -> Markup { html!( """ h2 { font-size: 2.5rem; color: #2F3C57; text-decoration: 0.1rem solid underline black; } h3 { font-size: 1.8rem; color: #2F3C57; padding: 2rem 0; } .latest-story { padding: 3rem; margin: 3rem; text-align: left; background-color: #FFD1A3; hyphens: auto; * { margin: 1rem 0; } p { font-size: 1.2rem; } } a { text-decoration: underline; color: #3D1D49; } ul { list-style: none; } .content-warning { background-color: #EC7981; margin: 2rem 0; padding: 0.3rem; width: fit-content; } """ ) } }