Skip to content

Instantly share code, notes, and snippets.

@tvirolai
Created August 18, 2019 08:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tvirolai/4ece753a0d23676cc24c81dcb574ad29 to your computer and use it in GitHub Desktop.
Save tvirolai/4ece753a0d23676cc24c81dcb574ad29 to your computer and use it in GitHub Desktop.
(defn square
[enemy? {:keys [clicked? ship?] :as p}]
(let [c (str "square"
(when (and ship? (or (false? enemy?) clicked?))
" has-background-primary"))]
^{:key (str "row-" (gensym))}
[:div {:class c}]))
(defn row [enemy? r]
^{:key (str "row-" (gensym))}
[:div.row.horizontal-flex
(map (partial square enemy?) r)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment