Skip to content

Commit

Permalink
support element as menu item
Browse files Browse the repository at this point in the history
  • Loading branch information
tiye committed Sep 12, 2018
1 parent a80a4fc commit 1ec0997
Show file tree
Hide file tree
Showing 3 changed files with 180 additions and 82 deletions.
236 changes: 163 additions & 73 deletions calcit.edn

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion src/inflow_popup/comp/container.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@
(comp-menu-dialog
(fn [result d! m!] (println "result" result))
(fn [mutate!] (mutate! %cursor (update state :show-menu? not)))
{:haskell "Haskell", :clojure "Clojure"})))
{:haskell "Haskell",
:clojure "Clojure",
:elixir (div
{:style {}}
(div {} (<> "Elixir"))
(div {} (<> "...with an extra line")))})))
(comp-inspect "state" state nil)
(cursor-> :reel comp-reel states reel {}))))

Expand Down
19 changes: 11 additions & 8 deletions src/inflow_popup/comp/dialog.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
:on-click (fn [e d! m!] (on-close! m!))}
(div {:on-click on-focus, :style widget/card} element-inside)))

(def style-menu-item
{:border-bottom (str "1px solid " (hsl 0 0 90)),
:padding "0 16px",
:line-height "40px",
:min-width 240,
:max-width 400,
:cursor :pointer,
:white-space :nowrap})

(defcomp
comp-menu-dialog
(on-choose! on-close! candidates)
Expand Down Expand Up @@ -46,11 +55,5 @@
[idx
(div
{:on-click (fn [e d! m!] (on-choose! k d! m!) (on-close! m!)),
:style {:border-bottom (str "1px solid " (hsl 0 0 90)),
:padding "0 16px",
:line-height "40px",
:min-width 240,
:max-width 400,
:cursor :pointer,
:white-space :nowrap}}
(<> v))])))))))
:style style-menu-item}
(if (string? v) (<> v) v))])))))))

0 comments on commit 1ec0997

Please sign in to comment.