diff --git a/public/index.html b/public/index.html index e75bd5c..9f315ac 100644 --- a/public/index.html +++ b/public/index.html @@ -103,14 +103,34 @@ list-style-type: none; } - ul.results li { + ul.results li.result { padding: 36px 0; border-top: 2px dotted #dccb8b; } - .content p:last-child { + .post .metadata { + display: grid; + grid-template-columns: 1fr 1fr; + } + + .post .metadata .post-info { + text-align: right; + } + + .post .metadata .mentions, + .post .metadata .date { + color: #777; + } + + .post .content p:last-child { margin-bottom: 0 } + + .post ul.controls { + margin: 18px 0 0; + padding: 0; + list-style-type: none; + } diff --git a/src/computersandblues/lodestone/app.cljs b/src/computersandblues/lodestone/app.cljs index 8353bc2..3e81f6e 100644 --- a/src/computersandblues/lodestone/app.cljs +++ b/src/computersandblues/lodestone/app.cljs @@ -294,6 +294,13 @@ (defn user [{:keys [user]}] (:username user)) +(defn- list-accounts [accounts] + [:<> + (->> (map-indexed (fn [idx account] + ^{:key idx} [user {:user account}]) accounts) + (interleave (repeat ", ")) + (drop 1))]) + (defn attachment [{:keys [attachment]}] (case (:type attachment) "image" [:img {:src (:preview_url attachment) @@ -309,23 +316,25 @@ (defn post [{:keys [post]}] ; TODO: handle (:sensitive post) - [:article - [:div.users - [user {:user (:account post)}] - (when (seq (:mentions post)) - [:span.mentions - {:style #js {:color "#777"}} - " (mentioning " (->> (map-indexed (fn [idx account] - ^{:key idx} [user {:user account}]) - (:mentions post)) - (interleave (repeat ", ")) - (drop 1)) ")"])] - [:div.url [:a {:href (:url post)} (:url post)]] - [:div.content {:dangerouslySetInnerHTML (r/unsafe-html (:content post))} + [:article.post + [:header.metadata + [:section.users + [user {:user (:account post)}] + (when (seq (:mentions post)) + [:span.mentions + " (mentioning " [list-accounts (:mentions post)] ")"])] + [:section.post-info + [:time.date {:datetime (:created_at post)} (first (str/split (:created_at post) "T"))]]] + [:section.content {:dangerouslySetInnerHTML (r/unsafe-html (:content post))} (when (seq (:media_attachments post)) - [:div.attachments (map-indexed (fn [idx item] - ^{:key idx} [attachment {:attachment item}]) - (:media_attachments post))])] + [:section.attachments + (map-indexed (fn [idx item] + ^{:key idx} [attachment {:attachment item}]) + (:media_attachments post))])] + [:nav + [:ul.controls + [:li.control-element.url + [:a {:href (:url post) :target "_blank"} "↗ Open original post"]]]] #_[debug post]]) (defn- refresh-displayed-posts!