diff --git a/deps.edn b/deps.edn index 3109eae6c7..274db7b4f2 100755 --- a/deps.edn +++ b/deps.edn @@ -1,4 +1,4 @@ -{:paths ["src/main" "templates"] +{:paths ["src/main" "src/workspaces" "templates"] :deps {org.clojure/clojure {:mvn/version "1.10.0"} cheshire/cheshire {:mvn/version "5.10.0"} @@ -35,7 +35,8 @@ expound/expound {:mvn/version "0.8.6"} com.lambdaisland/glogi {:mvn/version "1.0.116"} binaryage/devtools {:mvn/version "1.0.2"} - instaparse/instaparse {:mvn/version "1.4.10"}} + instaparse/instaparse {:mvn/version "1.4.10"} + nubank/workspaces {:mvn/version "1.1.1"}} :aliases {:cljs {:extra-paths ["src/dev-cljs/" "src/test/" "src/electron/"] :extra-deps {org.clojure/clojurescript {:mvn/version "1.10.844"} diff --git a/public/workspaces/index.html b/public/workspaces/index.html new file mode 100644 index 0000000000..a0b8deeafb --- /dev/null +++ b/public/workspaces/index.html @@ -0,0 +1,15 @@ + + + + + + + + + +
+ + + + + diff --git a/public/workspaces/static b/public/workspaces/static new file mode 120000 index 0000000000..8e9b74c479 --- /dev/null +++ b/public/workspaces/static @@ -0,0 +1 @@ +../../static \ No newline at end of file diff --git a/shadow-cljs.edn b/shadow-cljs.edn index 9812294996..325f66c153 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -89,4 +89,20 @@ {:before-load frontend.core/stop ;; after live-reloading finishes call this function :after-load frontend.core/start - :preloads [devtools.preload]}}}} + :preloads [devtools.preload]}} + + :cards {:target nubank.workspaces.shadow-cljs.target + :ns-regexp "(test|cards)$" + :output-dir "./static/js/workspaces" + :asset-path "/static/js/workspaces" + :preloads [] ; optional, list namespaces to be pre loaded + :devtools + { + :after-load nubank.workspaces.core/after-load + :loader-mode :eval + :http-root "public/workspaces" + :http-port 9670 + :watch-path "static" + :preloads [devtools.preload + shadow.remote.runtime.cljs.browser]} + :modules {:main {:entries [workspaces.main]}}}}} diff --git a/src/workspaces/workspaces/cards.cljs b/src/workspaces/workspaces/cards.cljs new file mode 100644 index 0000000000..d0f97ac4ec --- /dev/null +++ b/src/workspaces/workspaces/cards.cljs @@ -0,0 +1,26 @@ +(ns workspaces.cards + (:require [nubank.workspaces.core :as ws] + [nubank.workspaces.model :as wsm] + [nubank.workspaces.card-types.react :as ct.react] + [nubank.workspaces.card-types.test :as ct.test] + [cljs.test :refer [is async]] + [rum.core :as rum] + [frontend.ui :as ui])) + +;; simple function to create react elemnents +(defn element [name props & children] + (apply js/React.createElement name (clj->js props) children)) + +(ws/defcard hello-card + (ct.react/react-card + (element "div" {} "Hello World"))) + +(rum/defc ui-button + [] + (ui/button "Text" + :background "green" + :on-click (fn [] (js/alert "button clicked")))) + +(ws/defcard button-card + (ct.react/react-card + (ui-button))) diff --git a/src/workspaces/workspaces/main.cljs b/src/workspaces/workspaces/main.cljs new file mode 100644 index 0000000000..cc7ca3851c --- /dev/null +++ b/src/workspaces/workspaces/main.cljs @@ -0,0 +1,5 @@ +(ns workspaces.main + (:require [nubank.workspaces.core :as ws] + [workspaces.cards])) + +(defonce init (ws/mount))