Change the grouping on the list pages.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Oly 2023-08-31 14:53:23 +01:00
parent 8f245cc929
commit 772d195271
3 changed files with 30 additions and 10 deletions

View File

@ -8,4 +8,4 @@ This site has various example's guides and snippets showing how to use Clojure a
Some of the struggles have been around Terminology & inter-op with the host languages along side re orientating my brain to think more functionally. Some of the struggles have been around Terminology & inter-op with the host languages along side re orientating my brain to think more functionally.
https://youtu.be/LKtk3HCgTa8 https://www.youtube.com/embed/LKtk3HCgTa8

View File

@ -244,14 +244,15 @@ To customize see https://maplibre.org/maplibre-gl-js/docs/
(defn libra-map-promesa [] (defn libra-map-promesa []
(load-libra-maps) (load-libra-maps)
(let [create-map (fn map-element [element] (let [create-map (fn map-element [element]
(.-innerHTML element "")
(new js/maplibregl.Map (new js/maplibregl.Map
(clj->js {:container (.-id element) #_"libra-map" (clj->js {:container (.-id element)
:style "https://demotiles.maplibre.org/style.json" :style "https://demotiles.maplibre.org/style.json"
:zoom 1})))] :zoom 1})))]
(fn [] (fn []
[:div#libra-map.m-auto [:div#libra-map.m-auto
{:style {:width "400px" :height "400px"} {:style {:width "400px" :height "400px"}
:ref create-map #_(reset! map-element %)} :ref create-map}
"libra map here"]))) "libra map here"])))

View File

@ -121,18 +121,20 @@
"silent" "" "silent" ""
@evaled-result)]])]))}))) @evaled-result)]])]))})))
(defn link-handler [v _]
(defn link-handler
"Should use youtube.com/embed for embeds"
[v _]
(cond (cond
(str/starts-with? (str (:href v)) "https://youtu.be/") (some? (re-matches #"^(https://youtu.be/|https://www.youtube.com/).*" (str (:href v))))
[:iframe {:src (:href v) [:iframe {:src (:href v)
:title "YouTube video player" :title "YouTube video player"
:width "560" :width "560"
:height "315" :height "315"
:frameborder "0" :frameborder "0"
:allow "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"}] :allow "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"}]
:else [:a {:href (:href v)} (str v)] :else [:a {:href (:href v)} (str v)]))
)
)
(def theme-tachyon (def theme-tachyon
(merge tachyon-theme (merge tachyon-theme
@ -277,9 +279,26 @@
:link (rfe/href :page {:page "reagent-demo"}) :link (rfe/href :page {:page "reagent-demo"})
:img-src "https://raw.githubusercontent.com/reagent-project/reagent/master/logo/logo-text.png"}]}]]) :img-src "https://raw.githubusercontent.com/reagent-project/reagent/master/logo/logo-text.png"}]}]])
(defn grouped-list [data]
[articles
{:title (-> data :title)
:body (-> data :intro)
:articles
(mapv (fn fmt-map [demo]
{:title (:title demo)
:description (:description demo)
:link (rfe/href :page {:page (:page demo)})
:img-src (:icon-image demo)})
(-> data :demos))}])
(defn grouped-page [route] (defn grouped-page [route]
(let [group (keyword (name (:name (:data route))))] (let [group (keyword (name (:name (:data route))))]
[:<> [articles (if (vector? (-> site-data :pages group ))
(into [:div]
(mapv #(grouped-list %) (-> site-data :pages group)))
(grouped-list (-> site-data :pages group )))
#_[:<> [articles
{:title (-> site-data :pages group :title) {:title (-> site-data :pages group :title)
:body (-> site-data :pages group :intro) :body (-> site-data :pages group :intro)
:articles :articles