Skip to content

Instantly share code, notes, and snippets.

@ibdknox ibdknox/step2.clj
Created Jun 21, 2011

Embed
What would you like to do?
get started step 2
(defpartial todo-item [{:keys [id title due]}]
[:li {:id id} ;; maps define HTML attributes
[:h3 title]
[:span.due due]]) ;; add a class
(defpartial todos-list [items]
[:ul#todoItems ;; set the id attribute
(map todo-item items)])
(todos-list [{:id "todo1"
:title "Get Milk"
:due "today"}])
;; =>
;; <ul id="todoItems">
;; <li id="todo1">
;; <h3>Get Milk</h3>
;; <span class="due">today</span>
;; </li>
;; </ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.