Compare commits
1 Commits
33557b36df
...
2460cfe73f
Author | SHA1 | Date |
---|---|---|
|
2460cfe73f |
|
@ -17,7 +17,7 @@
|
|||
{:file "datalog-demo.org" :git-link "https://github.com/atomjuice/dsl-demo"}
|
||||
:reagent-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."})
|
||||
|
||||
;; Store site state
|
||||
|
@ -26,7 +26,7 @@
|
|||
;; for one component to render an article
|
||||
(defn article [{:keys [title description tagline]}]
|
||||
[:article {:data-name "article-full-bleed-background"}
|
||||
[:div.cf {:style {:background "url(http://mrmrs.github.io/photos/12.jpg)"
|
||||
[:div.cf {:style {:background "url(http://placekitten.com/g/600/300)"
|
||||
:no-repeat "center center fixed" :background-size "cover"}}
|
||||
[:div.fl.pa3.pa4-ns.bg-white.black-70.measure-narrow.f3.times
|
||||
[:header.b--black-70.pv4 {:class (when tagline "bb")}
|
||||
|
@ -35,9 +35,10 @@
|
|||
[:section.pt5.pb4 [:p.times.lh-copy.measure.f4.mt0 description]]]]])
|
||||
|
||||
;; form one component to render article tiles
|
||||
(defn articles [{:keys [title articles]}]
|
||||
(defn articles [{:keys [title body articles]}]
|
||||
[:section.mw7.center.avenir {:key title}
|
||||
[:h2.baskerville.fw1.ph3.ph0-l title]
|
||||
(when body [:p body])
|
||||
(map (fn [{:keys [title author link description img-src img-alt]}]
|
||||
[:article.bt.bb.b--black-10
|
||||
[:a.db.pv4.ph3.ph0-l.no-underline.black.dim {:href link}
|
||||
|
@ -52,8 +53,9 @@
|
|||
articles)])
|
||||
|
||||
;; form one component to render a product
|
||||
(defn product-card [{:keys [title amount description link]}]
|
||||
[:article.br2.ba.dark-gray.b--black-10.mv4.w-100.w-50-m.w-25-l.mw5.center
|
||||
(defn product-card
|
||||
[{:keys [title amount description link]}]
|
||||
[: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}]
|
||||
[:div.pa2.ph3-ns.pb3-ns
|
||||
[:div.dt.w-100.mt1
|
||||
|
@ -85,11 +87,13 @@
|
|||
|
||||
|
||||
;; form one homepage component
|
||||
|
||||
|
||||
(defn home-page []
|
||||
[:<>
|
||||
[:h1 (:lorem @site-state)]
|
||||
[articles
|
||||
{:title "Clojure Demos"
|
||||
:body (-> site-data :homepage :intro)
|
||||
:articles [{:title "DSL Demo"
|
||||
:link (rfe/href ::demo {:page "dsl-demo"})
|
||||
:img-src "https://miro.medium.com/max/1400/1*CEYFj5R57UFyCXts2nsBqA.png"}
|
||||
|
@ -100,7 +104,7 @@
|
|||
:link (rfe/href ::demo {:page "reagent-demo"})
|
||||
:img-src "https://raw.githubusercontent.com/reagent-project/reagent/master/logo/logo-text.png"}]}]])
|
||||
|
||||
;; form one render demo component
|
||||
;; form two component render demo
|
||||
(defn demo-page [route]
|
||||
(let [demo-key (keyword (-> route :parameters :path :page))
|
||||
content (reagent/atom {})]
|
||||
|
@ -113,28 +117,34 @@
|
|||
(reset! content))
|
||||
#_(reset! content (org->replacements (parse response))))})
|
||||
(fn [route]
|
||||
;[:div (-> route :parameters :path :page)]
|
||||
[:main.mt4
|
||||
|
||||
[:div.mw7.center.avenir @content]
|
||||
#_[article {:title "Homepage"
|
||||
:description @content
|
||||
:tagline "tagline here"}]])))
|
||||
[:div.mw7.center.avenir @content]])))
|
||||
|
||||
;; form one render about page component
|
||||
|
||||
|
||||
(defn about-page []
|
||||
[:main.mt4
|
||||
[:section.mw7.center.avenir
|
||||
[:h1 "Clojure library examples to aid learning"]
|
||||
[:p "Selection of clojure demos, rendered in reagent which itself is an example of using reagent."]
|
||||
[my-component "component 1"]
|
||||
[my-component "component 2"]
|
||||
[circle {:alt "test"}]
|
||||
[product-card
|
||||
{:title "title"
|
||||
:amount "10.59"
|
||||
:description "long description here"
|
||||
:href "test-link"}]]])
|
||||
[:main.mt4
|
||||
[:section.mw7.center.avenir
|
||||
[:h1 "Clojure library examples to aid learning"]
|
||||
[:p "Selection of clojure demos, rendered in reagent which itself is an example of using reagent."]
|
||||
[my-component "component 1"]
|
||||
[my-component "component 2"]
|
||||
[circle {:alt "test"}]
|
||||
[article {:title "Article"
|
||||
:description (-> site-data :lorem)
|
||||
:tagline "tagline here"}]
|
||||
[:div.flex.flex-column.flex-row-ns
|
||||
[product-card
|
||||
{:title "Cat 01"
|
||||
:amount "£54.59"
|
||||
:description "Cat description here"
|
||||
:link "http://placekitten.com/g/600/300"}]
|
||||
[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
|
||||
;; or just render the rest of the page if all is good
|
||||
|
|
Loading…
Reference in New Issue