Skip to content

Commit

Permalink
use render as default method name; alpha release
Browse files Browse the repository at this point in the history
  • Loading branch information
tiye committed Jun 7, 2020
1 parent 6836dc4 commit ae949d9
Show file tree
Hide file tree
Showing 7 changed files with 214 additions and 168 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Alerts
{:title "demo",
:style {:width 400},
:container-style {},
:render-body (fn [on-close] (div {} (<> "Place for child content")))})])
:render (fn [on-close] (div {} (<> "Place for child content")))})])
((:show demo-modal) d!)
```

Expand Down Expand Up @@ -174,7 +174,7 @@ Since every component has its own internal states, I use `>>` in all examples:
```clojure
(let [on-close (fn [d!] (d! cursor (assoc state :show? false)))]
(comp-modal
(:show? state, :render-body (fn [on-close] (div {} (<> "Place for child content"))))
{:show? state, :render (fn [on-close] (div {} (<> "Place for child content")))}
{:title "Demo", :style {:width 400}, :container-style {}}
on-close))
```
Expand Down
57 changes: 50 additions & 7 deletions calcit.cirru
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@
:id |PLkA2dwhOtI
|x $ {} (:type :expr) (:by |rJG4IHzWf) (:at 1584848020826)
:data $ {}
|T $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1584848020826) (:text |:render-body) (:id |oGycKJS0isq)
|T $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1591519391257) (:text |:render) (:id |oGycKJS0isq)
|j $ {} (:type :expr) (:by |rJG4IHzWf) (:at 1584848020826)
:data $ {}
|T $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1584848020826) (:text |fn) (:id |_AFtg_Os8y0)
Expand Down Expand Up @@ -5123,14 +5123,57 @@
:data $ {}
|T $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1572781324267) (:text |<>) (:id |XiYz4N-XCleaf)
|j $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1572781325419) (:text |title) (:id |ee1vdrQvd)
|r $ {} (:type :expr) (:by |rJG4IHzWf) (:at 1584849560490)
|r $ {} (:type :expr) (:by |rJG4IHzWf) (:at 1591519320538)
:data $ {}
|T $ {} (:type :expr) (:by |rJG4IHzWf) (:at 1572780806667) (:id |5HftAS7VW)
|D $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1591519440157) (:text |cond) (:id |F3ORTUXYC2)
|L $ {} (:type :expr) (:by |rJG4IHzWf) (:at 1591519324125)
:data $ {}
|T $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1584849558047) (:text |:render-body) (:id |_dp-muS-Z)
|j $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1584849559456) (:text |options) (:id |JqlJCDIt8)
|j $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1591205298151) (:text |on-close) (:id |ChoaXc5bwU)
:id |8orypK6EO
|T $ {} (:type :expr) (:by |rJG4IHzWf) (:at 1591519324989)
:data $ {}
|T $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1591519325717) (:text |some?) (:id |21k2xGqCnC)
|j $ {} (:type :expr) (:by |rJG4IHzWf) (:at 1591519328529)
:data $ {}
|T $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1591519328529) (:text |:render) (:id |Euz36KFMAk)
|j $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1591519328529) (:text |options) (:id |eurWko6Gs6)
:id |xjiGIvJuIh
:id |ifqM4BtCxz
|j $ {} (:type :expr) (:by |rJG4IHzWf) (:at 1591519330699)
:data $ {}
|T $ {} (:type :expr) (:by |rJG4IHzWf) (:at 1591519330315)
:data $ {}
|T $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1591519330315) (:text |:render) (:id |n6aDiQ4UZT)
|j $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1591519330315) (:text |options) (:id |ed2AqALPAh)
:id |038clsTtSC
|j $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1591519335982) (:text |on-close) (:id |-L-gEqbbr)
:id |7Oa_50h5pj
:id |6-53ThcLy
|P $ {} (:type :expr) (:by |rJG4IHzWf) (:at 1591519324125)
:data $ {}
|T $ {} (:type :expr) (:by |rJG4IHzWf) (:at 1591519324989)
:data $ {}
|T $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1591519325717) (:text |some?) (:id |21k2xGqCnC)
|j $ {} (:type :expr) (:by |rJG4IHzWf) (:at 1591519328529)
:data $ {}
|T $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1591519341382) (:text |:render-body) (:id |Euz36KFMAk)
|j $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1591519328529) (:text |options) (:id |eurWko6Gs6)
:id |xjiGIvJuIh
:id |ifqM4BtCxz
|j $ {} (:type :expr) (:by |rJG4IHzWf) (:at 1591519330699)
:data $ {}
|T $ {} (:type :expr) (:by |rJG4IHzWf) (:at 1591519330315)
:data $ {}
|T $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1591519342528) (:text |:render-body) (:id |n6aDiQ4UZT)
|j $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1591519330315) (:text |options) (:id |ed2AqALPAh)
:id |038clsTtSC
|j $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1591519335982) (:text |on-close) (:id |-L-gEqbbr)
:id |7Oa_50h5pj
:id |sW9_lP63J
|h $ {} (:type :expr) (:by |rJG4IHzWf) (:at 1591519345036)
:data $ {}
|T $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1591519345888) (:text |:else) (:id |7KKfJI18bXleaf)
|j $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1591519353962) (:text "|\"TODO render body") (:id |dRp6TnzKWn)
:id |7KKfJI18bX
:id |2QwYEpJfT-
|comp-select-modal $ {} (:type :expr) (:by |rJG4IHzWf) (:at 1572192345794) (:id |DrZAwDxDL7)
:data $ {}
|T $ {} (:type :leaf) (:by |rJG4IHzWf) (:at 1572192348371) (:text |defcomp) (:id |cBK1Qg_wqP)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"author": "jiyinyiyong",
"license": "MIT",
"devDependencies": {
"shadow-cljs": "^2.10.3"
"shadow-cljs": "^2.10.4"
},
"dependencies": {
"shortid": "^2.2.15"
Expand Down
2 changes: 1 addition & 1 deletion release.edn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{:version "0.5.3",
{:version "0.5.4-a1",
:group-id "respo",
:artifact-id "alerts",
:skip-tag true,
Expand Down
2 changes: 1 addition & 1 deletion src/respo_alerts/comp/container.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
{:title "demo",
:style {:width 400},
:container-style {},
:render-body (fn [on-close]
:render (fn [on-close]
(div
{}
(<> "Place for child content")
Expand Down
5 changes: 4 additions & 1 deletion src/respo_alerts/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,10 @@
:on-click (fn [e d!] )}
(let [title (:title options)]
(if (some? title) (div {:style (merge ui/center {:padding "8px"})} (<> title))))
((:render-body options) on-close)))))])
(cond
(some? (:render options)) ((:render options) on-close)
(some? (:render-body options)) ((:render-body options) on-close)
:else "TODO render body")))))])

(def style-menu-item
{:border-top (str "1px solid " (hsl 0 0 90)),
Expand Down

0 comments on commit ae949d9

Please sign in to comment.