From 05c1e6e4db0c40f826d6cd35b1be767b0e3d6f1d Mon Sep 17 00:00:00 2001 From: Colin Reeder Date: Sat, 8 Aug 2020 18:01:20 -0600 Subject: Use icon for like buttons --- icons/res/upvote.svg | 4 +++ icons/res/upvoted.svg | 4 +++ icons/src/lib.rs | 4 ++- res/lang/en.ftl | 2 -- res/lang/eo.ftl | 2 -- res/main.css | 31 ++++++++++++++++++ src/components/mod.rs | 90 ++++++++++++++++++++++++++++----------------------- src/routes/mod.rs | 38 +++++++++++----------- src/routes/posts.rs | 34 +++++++++++-------- 9 files changed, 131 insertions(+), 78 deletions(-) create mode 100644 icons/res/upvote.svg create mode 100644 icons/res/upvoted.svg diff --git a/icons/res/upvote.svg b/icons/res/upvote.svg new file mode 100644 index 0000000..25d1c93 --- /dev/null +++ b/icons/res/upvote.svg @@ -0,0 +1,4 @@ + + + + diff --git a/icons/res/upvoted.svg b/icons/res/upvoted.svg new file mode 100644 index 0000000..5041744 --- /dev/null +++ b/icons/res/upvoted.svg @@ -0,0 +1,4 @@ + + + + diff --git a/icons/src/lib.rs b/icons/src/lib.rs index 355e674..0728295 100644 --- a/icons/src/lib.rs +++ b/icons/src/lib.rs @@ -43,7 +43,9 @@ macro_rules! icons { icons! { NOTIFICATIONS => "notifications.svg", NOTIFICATIONS_SOME => "notifications-some.svg", - PERSON => "person.svg" + PERSON => "person.svg", + UPVOTE => "upvote.svg", + UPVOTED => "upvoted.svg" } pub use icons::*; diff --git a/res/lang/en.ftl b/res/lang/en.ftl index ab31313..2c52478 100644 --- a/res/lang/en.ftl +++ b/res/lang/en.ftl @@ -30,8 +30,6 @@ follow_request_sent = Follow request sent! follow_undo = Unfollow home_follow_prompt1 = Why not home_follow_prompt2 = follow some communities? -like = Like -like_undo = Unlike liked_by = Liked by: likes = Likes local = Local diff --git a/res/lang/eo.ftl b/res/lang/eo.ftl index 1629cc7..34d4350 100644 --- a/res/lang/eo.ftl +++ b/res/lang/eo.ftl @@ -30,8 +30,6 @@ follow_request_sent = Abonado peto senditas! follow_undo = Ne plu aboni home_follow_prompt1 = Kial ne home_follow_prompt2 = aboni iujn komunumojn? -like = Ŝati -like_undo = Ne plu ŝati liked_by = Ŝatata de: likes = Ŝatantoj local = Loka diff --git a/res/main.css b/res/main.css index 1ce5be8..a459402 100644 --- a/res/main.css +++ b/res/main.css @@ -77,6 +77,37 @@ body { vertical-align: text-bottom; } +.iconbutton { + padding: 0; +} + +.iconbutton > .icon { + margin-left: -1em; + margin-right: -1em; +} + +.votebox { + float: left; + margin-right: .5em; +} + +.comment > .content { + display: inline-block; +} + +.commentList { + margin-top: .5em; + list-style-type: none; +} + +.commentList.topLevel { + padding-left: 0; +} + +form.inline { + display: inline-block; +} + @media (max-width: 768px) { .communitySidebar { display: none; /* TODO still show this somewhere */ diff --git a/src/components/mod.rs b/src/components/mod.rs index 9527972..255f38a 100644 --- a/src/components/mod.rs +++ b/src/components/mod.rs @@ -20,55 +20,65 @@ pub fn Comment<'a>( lang: &'a crate::Translator, ) { render::rsx! { -
  • - - - {" "} - - - -
    - { - if base_data.login.is_some() { - Some(render::rsx! { - <> - { - if comment.your_vote.is_some() { - render::rsx! { -
    - -
    - } - } else { - render::rsx! { -
    - -
    - } +
  • + { + if base_data.login.is_some() { + Some(render::rsx! { +
    + { + if comment.your_vote.is_some() { + render::rsx! { +
    + +
    + } + } else { + render::rsx! { +
    + +
    } } + } +
    + }) + } else { + None + } + } +
    + + + {" "} + + + +
    + { + if base_data.login.is_some() { + Some(render::rsx! { {lang.tr("reply", None)} - - }) - } else { - None + }) + } else { + None + } } - } - { - if author_is_me(&comment.author, &base_data.login) { - Some(render::rsx! { - {lang.tr("delete", None)} - }) - } else { - None + { + if author_is_me(&comment.author, &base_data.login) { + Some(render::rsx! { + {lang.tr("delete", None)} + }) + } else { + None + } } - } +
    { if let Some(replies) = &comment.replies { Some(render::rsx! { -