diff --git a/crates/web/assets/app.css b/crates/web/assets/app.css index 3ca2928..d894e97 100644 --- a/crates/web/assets/app.css +++ b/crates/web/assets/app.css @@ -4,9 +4,10 @@ body { font-family: system-ui, sans-serif; margin: 0; color: #1a1a1a; height: 10 .content-header h2 { margin: 0; } .article-scroll-area { flex: 1; min-height: 0; padding: 0 1.5rem 1.5rem; } .article-list { list-style: none; padding: 0; margin: 0; } -.article-row { border-bottom: 1px solid #ddd; padding: 1rem 0; } +.article-row { border-bottom: 1px solid #ddd; padding: 1rem 0; display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem; } +.article-row-header { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.5rem; } .article-row a { font-weight: 600; text-decoration: none; color: #0b5fff; } -.summary { color: #444; margin: 0.4rem 0; } +.summary { color: #444; margin: 0; } .topics { display: flex; flex-wrap: wrap; gap: 0.3rem; } .error { color: #b00020; } .subscribe-form { display: flex; gap: 0.5rem; margin: 1rem 0; } diff --git a/crates/web/src/app/article_row.rs b/crates/web/src/app/article_row.rs index 50fca43..123d735 100644 --- a/crates/web/src/app/article_row.rs +++ b/crates/web/src/app/article_row.rs @@ -1,6 +1,7 @@ use crate::api; use crate::api::ArticleView; use crate::components::badge::{Badge, BadgeVariant}; +use crate::components::button::{Button, ButtonSize, ButtonVariant}; use dioxus::prelude::*; #[component] @@ -8,17 +9,25 @@ pub fn ArticleRow(article: ArticleView) -> Element { let score_pct = article.final_score.map(|s| (s * 100.0).round() as i32); rsx! { li { class: "article-row", - a { href: "{article.url}", target: "_blank", "{article.title}" } - if let Some(pct) = score_pct { - Badge { variant: BadgeVariant::Secondary, "{pct}%" } - } - p { class: "summary", "{article.summary}" } - div { class: "topics", - for topic in article.topics.iter() { - Badge { variant: BadgeVariant::Outline, "{topic}" } + div { class: "article-row-header", + a { href: "{article.url}", target: "_blank", "{article.title}" } + if let Some(pct) = score_pct { + Badge { variant: BadgeVariant::Secondary, "{pct}%" } } } - button { + if !article.summary.trim().is_empty() { + p { class: "summary", "{article.summary}" } + } + if !article.topics.is_empty() { + div { class: "topics", + for topic in article.topics.iter() { + Badge { variant: BadgeVariant::Outline, "{topic}" } + } + } + } + Button { + variant: ButtonVariant::Outline, + size: ButtonSize::Sm, onclick: move |_| { let id = article.id.clone(); async move {