Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show hide components in Single Page App #79

Open
practicalli-johnny opened this issue Jul 23, 2021 · 0 comments
Open

Show hide components in Single Page App #79

practicalli-johnny opened this issue Jul 23, 2021 · 0 comments
Labels

Comments

@practicalli-johnny
Copy link
Contributor

https://stackoverflow.com/questions/56908280/clojurescript-change-display-none-to-visible

Hide / Show reagent form
https://gist.github.com/aarkerio/11a8606a1253fea50910a17325826536

(defn question-item
  [{:keys [question explanation hint key qtype id ordnen] :as q}]
  (let [counter (reagent/atom 0)
        editing (reagent/atom false)]   ;; show and switch icons (Edit/Cancel) 
    (fn []
    [:div.div-separator {:key (str "div-question-separator-" id) :id (str "div-question-separator-" id)}
     (if @editing
       [:img.img-float-right {:title    "Cancel question"
                              :alt      "Cancel question"
                              :key      (str "cancel-question-img-" id)
                              :id       (str "cancel-question-img-" id)
                              :src      "/img/icon_cancel.png"
                              :on-click #(swap! editing not)}]
       [:img.img-float-right {:title    "Edit question"
                              :alt      "Edit question"
                              :key      (str "edit-question-img-" id)
                              :id       (str "edit-question-img-" id)
                              :src      "/img/icon_edit.png"
                              :on-click #(swap! editing not)}])
     [:p {:key (str "div-question" id) :id (str "div-question" id)} [:span.bold-font (str key ".-")] "Question: " question  "   ordnen:" ordnen "   id:" id]
     [:p {:key (str "div-hint" id)     :id (str "div-hint" id)}     [:span.bold-font "Hint: "] hint]
     [:p {:key (str "div-explan" id)   :id (str "div-explan" id)}   [:span.bold-font "Explanation: "] explanation]
     (when @editing
       [simple-input q])  <-- react component
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant