Skip to content

Commit

Permalink
Refactor bottom-actions to have button props in maps
Browse files Browse the repository at this point in the history
  • Loading branch information
tumanov-alex committed Oct 31, 2023
1 parent b32b551 commit 91a8c2f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 19 deletions.
27 changes: 15 additions & 12 deletions src/quo/components/drawers/bottom_actions/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -29,32 +29,35 @@
rendered
:customization-color - keyword (default nil) - Color for the first button
:button-one-type - same as button/button :type
:button-two-type - same as button/button :type"
:button-two-type - same as button/button :type
:button-one-props - map (default nil) - Props for the first button
:button-two-props - map (default nil) - Props for the second button"
[props]
(let [{:keys [actions description button-one-disabled?
button-two-disabled? button-one-label button-two-label
button-one-press button-two-press theme
scroll? customization-color button-one-type button-two-type]}
(let [{:keys [actions description theme
scroll? customization-color
button-one-props button-two-props]}
(merge default-props props)]
[:<>
[rn/view {:style style/buttons-container}
(when (= actions :2-actions)
[button/button
{:size 40
:disabled? button-two-disabled?
:disabled? (:disabled? button-two-props)
:background (when scroll? :blur)
:container-style style/button-container-2-actions
:type button-two-type
:on-press button-two-press} button-two-label])
:type (:type button-two-props)
:on-press (:on-press button-two-props)}
(:label
button-two-props)])
[button/button
{:size 40
:disabled? button-one-disabled?
:disabled? (:disabled? button-one-props)
:container-style style/button-container
:type button-one-type
:type (:type button-one-props)
:background (when scroll? :blur)
:on-press button-one-press
:on-press (:on-press button-one-props)
:customization-color customization-color
:accessibility-label :button-one} button-one-label]]
:accessibility-label :button-one} (:label button-one-props)]]
(when description
[text/text
{:size :paragraph-2
Expand Down
12 changes: 6 additions & 6 deletions src/status_im2/contexts/quo_preview/drawers/bottom_actions.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
[]
(let [state (reagent/atom {:actions :2-actions
:description description
:button-one-label button-one
:button-two-label button-two
:button-one-press (button-press 2)
:button-two-press (button-press 1)
:button-one-type :primary
:button-two-type :grey
:button-one-props {:type :primary
:label button-one
:on-press (button-press 2)}
:button-two-props {:type :grey
:label button-two
:on-press (button-press 1)}
:scroll? false})]
(fn []
[preview/preview-container
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
{:page-nav-right-side [{:icon-name :i/info
:on-press
#(js/alert
"Get info (to be
"Get info (to be
implemented)")}]
:account-name @account-name
:account-emoji @account-emoji
Expand Down

0 comments on commit 91a8c2f

Please sign in to comment.