-
-
Save otwieracz/3e39cfec5e7f8c151b37b2268e70393b to your computer and use it in GitHub Desktop.
This file contains 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
(def ui-wire (comp/factory Wire {:keyfn :wire/id})) | |
(defsc WireList [_this {:keys [wires]}] | |
{:query [{:wires (comp/get-query Wire)}] | |
;; :ident :wire-list/id | |
} | |
(println (str "Wires on WireList are: " wires)) | |
(ui-table {:striped true :hover true} | |
(thead | |
(tr | |
(th "Label") | |
(th "Color") | |
(th "Terminals") | |
(th "Saved?") | |
)) | |
(tbody | |
(map ui-wire wires)))) | |
(def ui-wire-list (comp/factory WireList #_{:keyfn :wire-list/id})) | |
(defsc Root [this {:keys [wires]}] | |
{:query [{:wires (comp/get-query Wire)}] | |
:initial-state {}} | |
(div | |
(when wires | |
(println (str "Wires on Wires are: " wires)) | |
(div | |
(ui-wire-list wires) | |
(ui-button {:onClick (fn [] (comp/transact! this [(mutations/add-wire {:wire-list/id :my-wires :wire/id 2})]))} "foo"))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment