-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
awb99
committed
Oct 21, 2023
1 parent
34a66fd
commit 80ad8a7
Showing
10 changed files
with
74 additions
and
41 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
{:name "demo" | ||
:cljs-routes {"" demo.page.options/page-options | ||
"controls" demo.page.controls/page-controls | ||
} | ||
:sci-cljs-ns [demo.page.options] | ||
:sci-cljs-ns [demo.page.options | ||
demo.page.controls] | ||
|
||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
(ns demo.page.controls | ||
(:require | ||
[reagent.core :as r] | ||
[options.edit :as edit])) | ||
|
||
(defn h1 [s] | ||
[:<> | ||
[:hr] | ||
[:br] | ||
[:h1 {:class "pt-5 pb-5 text-xl text-bold text-blue-700"} s]]) | ||
|
||
(def state-pet (r/atom :cat)) | ||
(def state-bool (r/atom true)) | ||
|
||
(defn page-controls [_] | ||
[:div | ||
[:a {:href "/"} | ||
[:p "goto options"]] | ||
|
||
[h1 "state"] | ||
[:div " pet: " (pr-str @state-pet) | ||
" bool: " (pr-str @state-bool)] | ||
|
||
[edit/bool {:set-fn #(reset! state-bool %) | ||
:options {:class "bg-red-300 p-2"}} | ||
@state-bool] | ||
|
||
[edit/select | ||
{:set-fn #(reset! state-pet %) | ||
:options {:class "placeholder-gray-400 text-gray-700 relative bg-white rounded text-sm border border-gray-400 outline-none focus:outline-none focus:shadow-outline" | ||
:spec [:cat :dog :parrot :hamster]}} | ||
@state-pet]]) |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
(ns options.edit | ||
(:require | ||
[options.editor.bool] | ||
[options.editor.button] | ||
[options.editor.select] | ||
[options.editor.string] | ||
[options.editor.view])) | ||
|
||
(def bool options.editor.bool/editor-bool) | ||
(def button options.editor.button/editor-button) | ||
(def select options.editor.select/editor-select) | ||
(def string options.editor.string/editor-string) | ||
(def view options.editor.view/editor-view) |
This file was deleted.
Oops, something went wrong.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
(ns options.editor.view) | ||
|
||
(defn editor-view [{:keys [options]} current-val] | ||
(let [{:keys [class] | ||
:or {class ""}} | ||
(let [{:keys [class] | ||
:or {class ""}} | ||
options] | ||
[:span {:class class} (pr-str current-val)])) |