Compare commits

..

1 Commits

Author SHA1 Message Date
Oliver Marks 33557b36df Refactor
continuous-integration/drone/push Build is passing Details
2021-01-29 14:02:49 +00:00
1 changed files with 25 additions and 35 deletions

View File

@ -17,7 +17,7 @@
{:file "datalog-demo.org" :git-link "https://github.com/atomjuice/dsl-demo"} {:file "datalog-demo.org" :git-link "https://github.com/atomjuice/dsl-demo"}
:reagent-demo :reagent-demo
{:file "reagent-reitit.org" :git-link "https://github.com/atomjuice/dsl-demo"}} {:file "reagent-reitit.org" :git-link "https://github.com/atomjuice/dsl-demo"}}
:homepage {:intro "Clojure tutorials examples and exploration"}
:lorem "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."}) :lorem "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."})
;; Store site state ;; Store site state
@ -26,7 +26,7 @@
;; for one component to render an article ;; for one component to render an article
(defn article [{:keys [title description tagline]}] (defn article [{:keys [title description tagline]}]
[:article {:data-name "article-full-bleed-background"} [:article {:data-name "article-full-bleed-background"}
[:div.cf {:style {:background "url(http://placekitten.com/g/600/300)" [:div.cf {:style {:background "url(http://mrmrs.github.io/photos/12.jpg)"
:no-repeat "center center fixed" :background-size "cover"}} :no-repeat "center center fixed" :background-size "cover"}}
[:div.fl.pa3.pa4-ns.bg-white.black-70.measure-narrow.f3.times [:div.fl.pa3.pa4-ns.bg-white.black-70.measure-narrow.f3.times
[:header.b--black-70.pv4 {:class (when tagline "bb")} [:header.b--black-70.pv4 {:class (when tagline "bb")}
@ -35,10 +35,9 @@
[:section.pt5.pb4 [:p.times.lh-copy.measure.f4.mt0 description]]]]]) [:section.pt5.pb4 [:p.times.lh-copy.measure.f4.mt0 description]]]]])
;; form one component to render article tiles ;; form one component to render article tiles
(defn articles [{:keys [title body articles]}] (defn articles [{:keys [title articles]}]
[:section.mw7.center.avenir {:key title} [:section.mw7.center.avenir {:key title}
[:h2.baskerville.fw1.ph3.ph0-l title] [:h2.baskerville.fw1.ph3.ph0-l title]
(when body [:p body])
(map (fn [{:keys [title author link description img-src img-alt]}] (map (fn [{:keys [title author link description img-src img-alt]}]
[:article.bt.bb.b--black-10 [:article.bt.bb.b--black-10
[:a.db.pv4.ph3.ph0-l.no-underline.black.dim {:href link} [:a.db.pv4.ph3.ph0-l.no-underline.black.dim {:href link}
@ -53,9 +52,8 @@
articles)]) articles)])
;; form one component to render a product ;; form one component to render a product
(defn product-card (defn product-card [{:keys [title amount description link]}]
[{:keys [title amount description link]}] [:article.br2.ba.dark-gray.b--black-10.mv4.w-100.w-50-m.w-25-l.mw5.center
[:article.br2.ba.dark-gray.b--black-10.ma2.w-100.w-50-m.w-25-l.mw5
[:img.db.w-100.br2.br--top {:src link}] [:img.db.w-100.br2.br--top {:src link}]
[:div.pa2.ph3-ns.pb3-ns [:div.pa2.ph3-ns.pb3-ns
[:div.dt.w-100.mt1 [:div.dt.w-100.mt1
@ -87,13 +85,11 @@
;; form one homepage component ;; form one homepage component
(defn home-page [] (defn home-page []
[:<> [:<>
[:h1 (:lorem @site-state)]
[articles [articles
{:title "Clojure Demos" {:title "Clojure Demos"
:body (-> site-data :homepage :intro)
:articles [{:title "DSL Demo" :articles [{:title "DSL Demo"
:link (rfe/href ::demo {:page "dsl-demo"}) :link (rfe/href ::demo {:page "dsl-demo"})
:img-src "https://miro.medium.com/max/1400/1*CEYFj5R57UFyCXts2nsBqA.png"} :img-src "https://miro.medium.com/max/1400/1*CEYFj5R57UFyCXts2nsBqA.png"}
@ -104,7 +100,7 @@
:link (rfe/href ::demo {:page "reagent-demo"}) :link (rfe/href ::demo {: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"}]}]])
;; form two component render demo ;; form one render demo component
(defn demo-page [route] (defn demo-page [route]
(let [demo-key (keyword (-> route :parameters :path :page)) (let [demo-key (keyword (-> route :parameters :path :page))
content (reagent/atom {})] content (reagent/atom {})]
@ -117,12 +113,15 @@
(reset! content)) (reset! content))
#_(reset! content (org->replacements (parse response))))}) #_(reset! content (org->replacements (parse response))))})
(fn [route] (fn [route]
;[:div (-> route :parameters :path :page)]
[:main.mt4 [:main.mt4
[:div.mw7.center.avenir @content]])))
[:div.mw7.center.avenir @content]
#_[article {:title "Homepage"
:description @content
:tagline "tagline here"}]])))
;; form one render about page component ;; form one render about page component
(defn about-page [] (defn about-page []
[:main.mt4 [:main.mt4
[:section.mw7.center.avenir [:section.mw7.center.avenir
@ -131,20 +130,11 @@
[my-component "component 1"] [my-component "component 1"]
[my-component "component 2"] [my-component "component 2"]
[circle {:alt "test"}] [circle {:alt "test"}]
[article {:title "Article"
:description (-> site-data :lorem)
:tagline "tagline here"}]
[:div.flex.flex-column.flex-row-ns
[product-card [product-card
{:title "Cat 01" {:title "title"
:amount "£54.59" :amount "10.59"
:description "Cat description here" :description "long description here"
:link "http://placekitten.com/g/600/300"}] :href "test-link"}]]])
[product-card
{:title "Cat 02"
:amount "£10.59"
:description "Cat description here"
:link "http://placekitten.com/g/600/300"}]]]])
;; form 3 component wrap rendering to catch errors and render them ;; form 3 component wrap rendering to catch errors and render them
;; or just render the rest of the page if all is good ;; or just render the rest of the page if all is good