-
Notifications
You must be signed in to change notification settings - Fork 985
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
chore: slider button - add error type, blur variant and fix small ui bug #17473
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 24 additions & 6 deletions
30
src/status_im2/contexts/quo_preview/buttons/slide_button.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,57 @@ | ||
(ns status-im2.contexts.quo-preview.buttons.slide-button | ||
(:require [quo2.core :as quo] | ||
[reagent.core :as reagent] | ||
[status-im2.contexts.quo-preview.preview :as preview])) | ||
[status-im2.contexts.quo-preview.preview :as preview] | ||
[react-native.core :as rn])) | ||
|
||
(def descriptor | ||
[{:key :size | ||
:type :select | ||
:options [{:key :size/s-48} | ||
{:key :size/s-40}]} | ||
:options [{:key :size-48} | ||
{:key :size-40}]} | ||
{:key :type | ||
:type :select | ||
:options [{:key :default} | ||
{:key :danger}]} | ||
{:key :disabled? | ||
:type :boolean} | ||
{:key :blur? | ||
:type :boolean} | ||
(preview/customization-color-option {:key :color})]) | ||
|
||
(defn view | ||
(defn f-view | ||
[] | ||
(let [state (reagent/atom {:disabled? false | ||
:color :blue | ||
:size :size/s-48}) | ||
:size :size-48}) | ||
color (reagent/cursor state [:color]) | ||
blur? (reagent/cursor state [:blur?]) | ||
complete? (reagent/atom false)] | ||
(fn [] | ||
(rn/use-effect (fn [] | ||
(reset! complete? true) | ||
(js/setTimeout #(reset! complete? false) 50)) | ||
[(:size @state)]) | ||
[preview/preview-container | ||
{:state state | ||
:descriptor descriptor | ||
:component-container-style {:align-items :center}} | ||
:component-container-style (when-not @blur? (:align-items :center)) | ||
:blur? @blur? | ||
:show-blur-background? true} | ||
(if (not @complete?) | ||
[quo/slide-button | ||
{:track-text "We gotta slide" | ||
:track-icon :face-id | ||
:customization-color @color | ||
:size (:size @state) | ||
:disabled? (:disabled? @state) | ||
:blur? @blur? | ||
:type (:type @state) | ||
:on-complete (fn [] | ||
(js/setTimeout (fn [] (reset! complete? true)) | ||
1000) | ||
(js/alert "I don't wanna slide anymore"))}] | ||
[quo/button {:on-press (fn [] (reset! complete? false))} | ||
"Try again"])]))) | ||
|
||
(defn view [] [:f> f-view]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If blur is only for the dark theme, should add the
blur-dark-only?
prop as well.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imo, this feature would have benefitted from discussion before being merged/moved forward. This
blur-dark-only?
option ignores that there is alsoblur-light-only
(at least I think there is some cases). Not to mention that there is many incorrect configurations of components possible on the preview screens. The button is a good example of this and a better alternative (imo) is to block incorrect configurations via disabling the descriptors for relevant options. This would of course benefit a lot if Mali gets added to the codebase.Having this discussion was mentioned here (although I'm not sure if the pr with this feature had got merged before, I assume it had so no big deal):
#17271 (comment)
response - #17271 (comment)
response - #17271 (comment)
imo it should be commonplace to discuss with those interested in the team before we add new features to the preview screens as they tend to effect everyone, and with a team so large it takes a while to make later refactors once a feature starts getting used.