[front/chore] format some code
This commit is contained in:
parent
44fbfc7ead
commit
27dadca343
1 changed files with 23 additions and 21 deletions
|
@ -23,14 +23,14 @@
|
||||||
[:p "questions"]
|
[:p "questions"]
|
||||||
(button 432539930 :question "question")
|
(button 432539930 :question "question")
|
||||||
(button 437735833 :question "question")
|
(button 437735833 :question "question")
|
||||||
(button 535225379 :question "question")
|
(button 535225379 :question "question")])
|
||||||
])
|
|
||||||
|
|
||||||
(defn about-page []
|
(defn about-page []
|
||||||
[:div
|
[:div
|
||||||
[:h2 "About"]
|
|
||||||
[:ul
|
[:ul
|
||||||
[:li [:a {:href "https://git.southfox.me/southfox/liberty-hu"} "Source code"]]]])
|
[:li
|
||||||
|
[:a
|
||||||
|
{:href "https://git.southfox.me/southfox/liberty-hu"} "Source code"]]]])
|
||||||
|
|
||||||
(defn item-page []
|
(defn item-page []
|
||||||
(let [loading @(subscribe [:loading])
|
(let [loading @(subscribe [:loading])
|
||||||
|
@ -58,32 +58,35 @@
|
||||||
[:h1 {:class "text-2xl"}
|
[:h1 {:class "text-2xl"}
|
||||||
(-> post :question :title)]
|
(-> post :question :title)]
|
||||||
[:div {:class "space-y-5"}
|
[:div {:class "space-y-5"}
|
||||||
(for [ans (:answers post)]
|
(for [answer (:answers post)]
|
||||||
^{:key ans}
|
^{:key answer}
|
||||||
[:div {:class "p-3 bg-white shadow rounded-lg"}
|
[:div {:class "p-3 bg-white shadow"}
|
||||||
[:div {:class "flex items-center mb-3"}
|
[:div {:class "flex items-center mb-3"}
|
||||||
[:img {:class "h-10 rounded"
|
[:img {:class "h-10 rounded"
|
||||||
:src (-> ans :author :avatar_url)}]
|
:src (-> answer :author :avatar_url)}]
|
||||||
[:a {:class "text-lg ml-3"}
|
[:a {:class "text-lg ml-3"}
|
||||||
(-> ans :author :name)]]
|
(-> answer :author :name)]]
|
||||||
[:div
|
[:div
|
||||||
{:dangerouslySetInnerHTML
|
{:dangerouslySetInnerHTML
|
||||||
{:__html (:content ans)}}]])]
|
{:__html (:content answer)}}]])]
|
||||||
(if end?
|
(if end?
|
||||||
[:p {:class "mt-5"} "answers end here."]
|
[:p {:class "mt-5"} "answers end here."]
|
||||||
(if (:more loading)
|
(if (:more loading)
|
||||||
[:p {:class "mt-5"} "loading more..."]
|
[:p {:class "mt-5"} "loading more..."]
|
||||||
[:div {:class "mt-5"}
|
[:div {:class "mt-5"}
|
||||||
[:button {:type "button"
|
[:button
|
||||||
:href (-> post :paging :next)
|
{:type "button"
|
||||||
:class "btn btn-blue"
|
:href (-> post :paging :next)
|
||||||
:on-click #(get-more %
|
:class "btn btn-blue"
|
||||||
{:request {:path "hq"
|
:on-click #(get-more
|
||||||
:id (-> post :paging :question_id)
|
%
|
||||||
:query {:cursor (-> post :paging :cursor)
|
{:request
|
||||||
:session_id (-> post :paging :session_id)}}
|
{:path "hq"
|
||||||
:db-path [:post :answers]
|
:id (-> post :paging :question_id)
|
||||||
:loading-type :comment})}
|
:query {:cursor (-> post :paging :cursor)
|
||||||
|
:session_id (-> post :paging :session_id)}}
|
||||||
|
:db-path [:post :answers]
|
||||||
|
:loading-type :comment})}
|
||||||
"Load More"]]))])))
|
"Load More"]]))])))
|
||||||
|
|
||||||
(defn nav [{:keys [current-route]}]
|
(defn nav [{:keys [current-route]}]
|
||||||
|
@ -94,7 +97,6 @@
|
||||||
[:li
|
[:li
|
||||||
[:a {:href (rfe/href :about)} (active :about) "About"]]]))
|
[:a {:href (rfe/href :about)} (active :about) "About"]]]))
|
||||||
|
|
||||||
|
|
||||||
(defn current-page []
|
(defn current-page []
|
||||||
(let [current-route @(subscribe [:current-route])]
|
(let [current-route @(subscribe [:current-route])]
|
||||||
[:div {:class "container p-2 mx-auto"}
|
[:div {:class "container p-2 mx-auto"}
|
||||||
|
|
Loading…
Reference in a new issue