-
Notifications
You must be signed in to change notification settings - Fork 987
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
Add quo2 dApp component #17074
Add quo2 dApp component #17074
Conversation
Jenkins BuildsClick to see older builds (8)
|
colors/white-opa-5 | ||
|
||
(= state :pressed) | ||
(colors/custom-color :blue 50 5) |
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.
We should not use :blue here, we want to pass 'customization-color' as a prop. You can check many other components that have that
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.
Yes, thank you. done.
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.
@J-Son89 does the current implementation (using customization-color
) look ok?
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.
ok, noted your comment below. done
[quo2.theme :as quo.theme])) | ||
|
||
(defn- view-internal | ||
[{:keys [dapp state action blur? on-press theme]}] |
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.
Perhaps the state :pressed should just be an internal var as it's local to the component depending on when the button is pressed or not.
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.
Could be... I copied the implementation of account list card, which passed code review last week. link
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.
yeah but that would mean we have to handle the state of pressed externally, I don't think we want that. it probably just went unnoticed in that component you linked. the quo2 button component does this ok imo 👍
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.
@ajayesivan's pr has recently got a similar effect to this: I think we should follow that ->
https://github.com/status-im/status-mobile/pull/17070/files#diff-aeb553e6b1e621275db78ccbbd16de99518862183c6fb9732a3e0e915326976f
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.
@J-Son89 Sounds good!
I concur. I would just like to point this out as an example of where we make an informed tradeoff of some fidelity between Figma properties and our component properties (in this case Figma uses state = default | pressed | active
).
Thanks for posting a link to an example!
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.
Yep 100%, and if anyone has some better approach then we can go with that. Imo the reason we want to match figma is so it's easy to configure on the pages, however pressed is not something we configure but rather the component handles itself
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.
yep, done.
0494114
to
dcf830d
Compare
:blur? false | ||
:customization-color :blue | ||
:on-press (h/mock-fn)}]) | ||
(h/is-truthy (h/get-by-text "coingecko.com")))) |
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.
It would be nice if you can add more tests, like on-press event and name.
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.
Thanks for you review @ajayesivan!
done.
:padding-horizontal 12 | ||
:padding-vertical 8 | ||
:border-radius 12 | ||
:background-color (cond |
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.
I like putting long conditions like this into their own function.
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.
yes, me too! done.
(defn cool-preview | ||
[] | ||
(let [state (reagent/atom {:dapp {:avatar (resources/get-mock-image :coin-gecko) | ||
:name "Coingecko" | ||
:value "coingecko.com"} | ||
:state :default | ||
:action :icon | ||
:blur? false | ||
:customization-color :blue | ||
:on-press (fn [] (js/alert "Button pressed"))})] | ||
(fn [] | ||
[rn/touchable-without-feedback {:on-press rn/dismiss-keyboard!} | ||
[rn/view {:padding-bottom 150} | ||
[rn/view {:flex 1} | ||
[preview/customizer state descriptor]] | ||
[rn/view | ||
{:padding-vertical 60 | ||
:flex-direction :row | ||
:justify-content :center} | ||
[quo/dapp @state]]]]))) | ||
|
||
(defn preview | ||
[] | ||
[rn/view | ||
{:background-color (colors/theme-colors colors/white | ||
colors/neutral-95) | ||
:flex 1} | ||
[rn/flat-list | ||
{:flex 1 | ||
:keyboard-should-persist-taps :always | ||
:header [cool-preview] | ||
:key-fn str}]]) |
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.
Thanks to Icaro! The preview boilerplate is no longer necessary. Please take a look at this PR for reference: #16996
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.
awesome! done.
[status-im2.contexts.quo-preview.preview :as preview])) | ||
|
||
(def descriptor | ||
[{:label "State" |
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.
You can omit :label
, it will be autogenerated from :key
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.
nice! done.
colors/white-opa-5 | ||
|
||
(= state :pressed) | ||
(colors/custom-color customization-color 50 5) |
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.
Yea but you probably have to have this themed too as it is 60 for dark.
E.g
(Colors/theme-colors
(Colors/custom-color ... 50 5)
(Colors/custom-color ... 60 5)
theme)
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.
Yes, we should use 60 variants for the dark theme, but for some reason, in Figma both variants (light & dark) are using 50 variants. Not sure, but probably a design bug. Maybe @mariocnovoa can take a look.
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.
@J-Son89 As @Parveshdhull mentioned, I followed the Figma designs. But I agree that with you both that this is probably a bug, so I updated it as you described. @mariocnovoa: if Figma is indeed correct, let me know, and I will revert this to use the same colors for both light and dark themes.
dcf830d
to
f773450
Compare
@Francesca-G Appreciate your review of this component |
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.
LGTM
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.
Nice job ✨
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.
LGTM 👍
f773450
to
78f7079
Compare
fixes #17022
status: ready