Skip to content

Commit

Permalink
Remove unused and unnecessary closable? flag
Browse files Browse the repository at this point in the history
  • Loading branch information
ilmotta committed Jun 14, 2023
1 parent 72e7d58 commit ae0f6ca
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 20 deletions.
5 changes: 2 additions & 3 deletions src/quo2/components/info/information_box/component_spec.cljs
Expand Up @@ -12,9 +12,8 @@
(h/test "with close button"
(let [on-close (h/mock-fn)]
(h/render [view/view
{:icon :i/placeholder
:closable? true
:on-close on-close}
{:icon :i/placeholder
:on-close on-close}
"Lorem ipsum"])
(h/is-null (h/query-by-label-text :information-box-action-button))
(h/fire-event :on-press (h/get-by-label-text :information-box-close-button))
Expand Down
5 changes: 2 additions & 3 deletions src/quo2/components/info/information_box/view.cljs
Expand Up @@ -44,7 +44,6 @@
"[view opts \"message\"]
opts
{:type :default/:informative/:error
:closable? bool (false) ;; Allow information box to be closed?
:closed? bool (false) ;; Information box's state
:icon keyword, required (:i/info)
:icon-size int (16)
Expand All @@ -53,7 +52,7 @@
:button-label string
:on-button-press function
:on-close function"
[{:keys [type closable? closed? icon style button-label
[{:keys [type closed? icon style button-label
on-button-press on-close no-icon-color? icon-size]}
message]
(when-not closed?
Expand All @@ -76,5 +75,5 @@
:button-label button-label
:on-button-press on-button-press
:message message}]
(when closable?
(when on-close
[close-button {:theme theme :on-close on-close}])])))
32 changes: 18 additions & 14 deletions src/status_im2/contexts/quo_preview/info/information_box.cljs
Expand Up @@ -27,27 +27,31 @@

(defn cool-preview
[]
(let [state (reagent/atom
{:type :default
:closable? true
:icon :i/info
:message (str "If you registered a stateofus.eth name "
"you might be eligible to connect $ENS")
:button-label "Button"
:style {:width 335}})
closed? (reagent/cursor state [:closed?])
on-close (fn []
(reset! closed? true)
(js/setTimeout (fn [] (reset! closed? false))
2000))]
(let [state (reagent/atom
{:type :default
:closable? true
:message (str "If you registered a stateofus.eth name "
"you might be eligible to connect $ENS")
:button-label "Button"})
closable? (reagent/cursor state [:closable?])
closed? (reagent/cursor state [:closed?])
on-close (fn []
(reset! closed? true)
(js/setTimeout (fn [] (reset! closed? false))
2000))]
(fn []
[rn/touchable-without-feedback {:on-press rn/dismiss-keyboard!}
[rn/view
[preview/customizer state descriptor]
[rn/view
{:style {:padding-vertical 20
:align-items :center}}
[quo/information-box (merge @state {:on-close on-close}) (:message @state)]]]])))
[quo/information-box
(merge {:icon :i/info
:style {:width 335}
:on-close (when @closable? on-close)}
@state)
(:message @state)]]]])))

(defn preview-information-box
[]
Expand Down

0 comments on commit ae0f6ca

Please sign in to comment.