-
Notifications
You must be signed in to change notification settings - Fork 0
/
panel.cljs
30 lines (26 loc) · 887 Bytes
/
panel.cljs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
(ns pinkgorilla.ui.layout.panel
(:require
[pinkie.pinkie :refer-macros [register-component]]))
; stolen from:
; https://github.com/knipferrc/tails-ui/blob/master/src/components/Panel.re
(defn ^{:category :layout}
panel
"a panel displays a seq of components
has a header"
[{:keys [color title extra]
:or {color "grey"
title "Panel Title"}}
& children]
[:div {:class (str "border-2 border-" color "-light rounded")}
[:div {:class (str "flex flex-row items-center justify-between w-full border-b-2 border-" color "-light p-2")}
[:div {:class "text-2xl text-grey-darker"}
title]
[:div extra]]
[:div {:class "p-2"}
;(into [] children)
(into [:div] children)
; the div wrapper for the c children is weird.
;(map-indexed (fn [i c] ^{:key i} [:div.p c]) children)
;children
]])
(register-component :p/panel panel)