Commit ed06d0ca authored by Bruno Burke's avatar Bruno Burke 😁

fullwidth select component for content-editor

parent 3e956fe0
......@@ -5,8 +5,7 @@
(defn select
[{:keys [value on-change options label multiple icons
expanded? fullwidth?
choose-option-label]}]
expanded? choose-option-label]}]
(let [id (gensym "select")
instance (reagent/atom nil)
change-fn (reagent/atom on-change)]
......@@ -14,7 +13,7 @@
{:display-name "input-select-component"
:reagent-render
(fn [{:keys [value on-change options label disabled multiple
choose-option-label icons expanded? fullwidth?]}]
choose-option-label icons expanded?]}]
[:<>
[control {:icons icons
:expanded? expanded?}
......@@ -22,7 +21,7 @@
{:class (str
(when multiple
" is-multiple")
(when fullwidth?
(when expanded?
" is-fullwidth"))
}
[:select
......@@ -61,7 +60,8 @@
(defn select*
[{:keys [cursor options label multiple
choose-option-label on-change]}]
choose-option-label on-change
expanded?]}]
(let [id (gensym "select")
instance (reagent/atom nil)
get-element #(js/document.querySelector (str "#" id))]
......@@ -69,12 +69,14 @@
{:display-name "select*-component"
:reagent-render
(fn [{:keys [cursor options label multiple
choose-option-label on-change]}]
choose-option-label on-change
expanded?]}]
[select
{:value @cursor
:options options
:label label
:multiple multiple
:expanded? expanded?
:choose-option-label choose-option-label
:on-change (fn [value]
(reset! cursor value)
......
......@@ -158,10 +158,12 @@
(for [line lines]
[:p {:key (hash line)} line]))]])
(when exercise-types
[ui/select*
{:cursor (reagent/cursor exercise [:core :type])
:options (mapv #(hash-map :key (first %) :title (second %)) exercise-types)
:label "Typ"}])
[ui/field {:expanded? true}
[ui/select*
{:expanded? true
:cursor (reagent/cursor exercise [:core :type])
:options (mapv #(hash-map :key (first %) :title (second %)) exercise-types)
:label "Typ"}]])
[:div
[:label "Aufgabenstellung"]
[content-editor/editor (reagent/cursor exercise [:core :task-description])]]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment