diff --git a/src/quo2/components/info/information_box/component_spec.cljs b/src/quo2/components/info/information_box/component_spec.cljs index 3690de4e867..64685a50f2b 100644 --- a/src/quo2/components/info/information_box/component_spec.cljs +++ b/src/quo2/components/info/information_box/component_spec.cljs @@ -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)) diff --git a/src/quo2/components/info/information_box/view.cljs b/src/quo2/components/info/information_box/view.cljs index c70187f9b2e..e08a73ed8d7 100644 --- a/src/quo2/components/info/information_box/view.cljs +++ b/src/quo2/components/info/information_box/view.cljs @@ -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) @@ -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? @@ -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}])]))) diff --git a/src/status_im2/contexts/quo_preview/info/information_box.cljs b/src/status_im2/contexts/quo_preview/info/information_box.cljs index 3eaeb34f0c6..d6248edba39 100644 --- a/src/status_im2/contexts/quo_preview/info/information_box.cljs +++ b/src/status_im2/contexts/quo_preview/info/information_box.cljs @@ -27,19 +27,18 @@ (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 @@ -47,7 +46,12 @@ [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 []