Created
May 1, 2018 00:13
-
-
Save lennyferguson/bded1e8f23d5f0fbd053c2dc348c9e8f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defprotocol ToCard | |
"Protocol for coercing a CardItem to a card" | |
(to-card [card] "Produces a bootstrap styled card item")) | |
(defrecord CardItem [title content img-link link] | |
ToCard | |
(to-card [_] | |
[:div.card.bg-dark.text-white | |
[:a.card-top {:href link} | |
[:img.card-img-top {:src img-link}]] | |
[:div.card-body | |
[:h5.card-title title] | |
[:p.card-text content]]])) | |
(def projects [{:name "Computer Graphics" :cards graphics-cards} | |
{:name "Web Software" :cards websoftware-cards} | |
{:name "Other" :cards other-cards}]) | |
(defn- template | |
([title & content] | |
(page/html5 | |
[:head | |
[:title (str "Stewart's Blog " title)] | |
(include-css "/stylesheets/custom.css")] | |
[:body | |
[:div.container | |
[:header.py-3 | |
[:div.row.flex-nowrap.justify-content-between.align-items-center | |
[:div.col-4.pt-1 [:a.btn.btn-sm.btn-outline-primary {:href "/"} "Stewart Charles"]] | |
[:h1.col-4.text-center (str title)] | |
[:div.col-4.d-flex.justify-content-end.align-items-center | |
[:a.btn.btn-sm.btn-outline-secondary {:href "/contact"} "Contact"]]]] | |
[:div.content | |
content]]] | |
[:footer.footer.text-center [:div.container [:span.text-muted "Created by Stewart Charles"]]]))) | |
(defn home [] | |
"This generates the home page" | |
(template | |
"Portfolio" | |
(map (fn [{name :name cards :cards}] | |
[:div | |
[:div.jumbotron.jumbotron-fluid | |
[:div.container | |
[:h1.display-4 name]]] | |
[:div.card-deck (map to-card cards)] | |
[:br]]) | |
projects))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment