summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Reeder <vpzomtrrfrt@gmail.com>2020-12-20 15:18:57 -0700
committerColin Reeder <vpzomtrrfrt@gmail.com>2020-12-20 15:18:57 -0700
commitec9a80efb3340d4254c460526cd698baa9a92314 (patch)
tree87170f9b54192955b0837890a332eca1e0543fb5
parent69ec042249e27097083da5f64598ac948335dfd4 (diff)
Limit post titles to one line in lists
-rw-r--r--res/main.css12
-rw-r--r--src/components/mod.rs26
2 files changed, 24 insertions, 14 deletions
diff --git a/res/main.css b/res/main.css
index 71a0e10..36359f5 100644
--- a/res/main.css
+++ b/res/main.css
@@ -113,6 +113,18 @@ body {
padding-left: 0;
}
+.titleLine {
+ white-space: nowrap;
+ display: flex;
+ padding-right: .5em;
+}
+.titleLine > a {
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ margin-right: .5em;
+}
+
form.inline {
display: inline-block;
}
diff --git a/src/components/mod.rs b/src/components/mod.rs
index c0ad1dc..869f021 100644
--- a/src/components/mod.rs
+++ b/src/components/mod.rs
@@ -299,22 +299,20 @@ pub fn PostItem<'a>(
) {
render::rsx! {
<li>
- <a href={format!("/posts/{}", post.as_ref().as_ref().id)}>
- {post.as_ref().as_ref().title.as_ref()}
- </a>
- {
- if let Some(href) = &post.as_ref().href {
- Some(render::rsx! {
- <>
- {" "}
+ <div class={"titleLine"}>
+ <a href={format!("/posts/{}", post.as_ref().as_ref().id)}>
+ {post.as_ref().as_ref().title.as_ref()}
+ </a>
+ {
+ if let Some(href) = &post.as_ref().href {
+ Some(render::rsx! {
<em><a href={href.as_ref()}>{abbreviate_link(&href)}{" ↗"}</a></em>
- </>
- })
- } else {
- None
+ })
+ } else {
+ None
+ }
}
- }
- <br />
+ </div>
<small>
{lang.tr("submitted", None)}
{" "}