Skip to content

Commit

Permalink
Add devcards
Browse files Browse the repository at this point in the history
  • Loading branch information
dan sutton committed Oct 24, 2018
1 parent 2480967 commit 1a76735
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
3 changes: 2 additions & 1 deletion dev.cljs.edn
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
^{:extra-main-files {:devcards {:main react-hitch.devcards-runner}
:test {:main react-hitch.test-runner}}
:watch-dirs ["src" "test" "devcards"]}
{:main react-hitch.qui-tracker}
{:main react-hitch.qui-tracker
:devcards true}
29 changes: 29 additions & 0 deletions devcards/react_hitch/card/wrapper.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
(ns react-hitch.card.wrapper
(:require [devcards.core :as dc]
[react-hitch.qui-tracker :as qui])
(:require-macros [devcards.core :refer [defcard]]))

(def stuff 3)

(defcard devcard-options-example-name
"Devcard options documentation."
(reify dc/IDevcardOptions
(-devcard-options [_ opts]
(assoc opts :main-obj opts))) ;; <-- alter :main-obj to be the passed in opts
{:devcards-options-init-state true})


(defcard hi
"hi"
{}
{}
{})

(defonce state (atom {:initial "state"}))




(defcard app-card
"Example card"
state)
2 changes: 1 addition & 1 deletion devcards/react_hitch/devcards_runner.cljs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(ns react-hitch.devcards-runner
(:require [devcards.core]
))
[react-hitch.card.wrapper]))

(devcards.core/start-devcard-ui!)

1 change: 1 addition & 0 deletions project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
[com.bhauman/figwheel-main "0.2.0-SNAPSHOT"]]
:source-paths ["test" "devcards"]
:resource-paths ["target"]
:clean-targets ^{:protect false} ["target"]
:aliases {"fig" ["trampoline" "run" "-m" "figwheel.main"]
"build-dev" ["trampoline" "run" "-m" "figwheel.main" "-b" "dev" "-r"]}}}
:source-paths ["src"])

0 comments on commit 1a76735

Please sign in to comment.