Created
June 21, 2011 21:30
-
-
Save ibdknox/1038952 to your computer and use it in GitHub Desktop.
get started step 2
This file contains hidden or 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
(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