web: apply title wrapping on search results page

This commit is contained in:
Bill Thiede 2025-04-10 12:32:46 -07:00
parent 2b4c45be74
commit 5a0378948d

View File

@ -273,6 +273,13 @@ fn search_results(
tags.remove(idx); tags.remove(idx);
}; };
let is_unread = unread_idx.is_some(); let is_unread = unread_idx.is_some();
let mut title_break = None;
const TITLE_LENGTH_WRAP_LIMIT: usize = 40;
for w in r.subject.split_whitespace() {
if w.len() > TITLE_LENGTH_WRAP_LIMIT {
title_break = Some(C!["break-all", "text-pretty"]);
}
}
div![ div![
C![ C![
"flex", "flex",
@ -315,7 +322,7 @@ fn search_results(
attrs! { attrs! {
At::Href => urls::thread(&tid) At::Href => urls::thread(&tid)
}, },
div![&r.subject], div![title_break, &r.subject],
span![C!["text-xs"], pretty_authors(&r.authors)], span![C!["text-xs"], pretty_authors(&r.authors)],
div![ div![
C!["flex", "flex-wrap", "justify-between"], C!["flex", "flex-wrap", "justify-between"],