-
Notifications
You must be signed in to change notification settings - Fork 984
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
feat: implement saved contact address list item component #17400
Conversation
Jenkins BuildsClick to see older builds (47)
|
f803294
to
a1b3c02
Compare
|
||
(defn- f-internal-view | ||
[] | ||
(let [state (reagent/atom :default) |
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 think we need to expose the state
prop to control the component from the parent. Maybe, just for the active
state. WYDT?
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.
Hmm I think we would not want to expose the whole state atom, but I could add a boolean prop to set if we want to set active state? WDYT?
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.
Oh, no. Not the atom. I meant the state
prop (Figma 1-1).
Most likely we might need a prop for the selected
state. Right now, the component handles it but we need to set it from the screen which uses this component.
{:state @state :customization-color customization-color}) | ||
:on-press-in on-press-in | ||
:on-press-out on-press-out | ||
:accessibility-label :container} |
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 believe we will need an on-press
prop.
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 added it, not too much change in the behavior from calling it in on-press-out
, but it feels more natural by calling it in on-press 👍
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 agree, Brian, but we need to rely on the on-press-out
for the animations.
I thought we would need an on-press
for handling any events (probably navigation) on press of the component.
{:no-color true | ||
:size 12 | ||
:color (colors/theme-colors | ||
(colors/custom-color :blue 50) | ||
(colors/custom-color :blue 60) | ||
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.
The color
won't be applied if we pass true to the no-color
prop.
P.S. If the icon has two colours, we need to use SVG. (ref quo2.components.icons.svg
ns)
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.
True! Thanks for the suggestion, added the icon as SVG as I need to slightly change the backgrond color while preserving the white shapes inside
{:size :paragraph-2 | ||
:weight :monospace | ||
:style (style/account-address theme)} | ||
(:address account-props)]] |
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's good to have the account-props
de-structured for better readability and maintainability.
[rn/view {:accessibility-label :check-icon} | ||
[icon/icon :i/chevron-right | ||
{:size 20 | ||
:color (colors/theme-colors colors/neutral-50 | ||
colors/neutral-40 | ||
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.
- I believe we will show the
chevron-right
icon if we have more than one account. - If the wrapper view is used only for accessibility, we can remove it and pass the
accessibility-label
to the icon.
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.
True! Nice catch, fixed it
|
||
(defn- internal-view | ||
[props] | ||
[:f> f-internal-view props]) |
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.
@briansztamfater - any reason why we use a functional component here?
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.
No, probably some copy-paste leftover, removed it
|
||
(defn- background-color | ||
[{:keys [state customization-color]}] | ||
(cond (or (= state :pressed) (= state :selected)) |
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.
should this not be themed? 🤔
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.
Hmm its just the customization color with different opacities with not difference on the themes, so I think not
{:no-color true | ||
:size 12 | ||
:color (colors/theme-colors | ||
(colors/custom-color :blue 50) |
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.
surely this is also not hardcoded as :blue
right? and it needs to be customization-color
instead?
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 changed it to use primary colors, it has some minor variation in the icon background, not supposed to be customizable
|
||
(h/describe "List items: saved contact address" | ||
(h/test "default render" | ||
(h/render [saved-contact-address/view {:accounts (repeat 1 account)}]) |
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'd suggest having one test rendering component without any props.
Some components tend to crash on this and that makes dev life harder when you try to use them later without knowing correct props.
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, this test it supposed to have no props, nice catch! Fixed it
2b3f6a7
to
846f0a5
Compare
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 one @briansztamfater!
:color (colors/theme-colors colors/primary-50 colors/primary-60 theme) | ||
:color-2 colors/white}]]] | ||
(if account-props | ||
[account account-props 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.
Maybe it's cleaner to assoc the map here instead of theme as it's own param
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.
Sure, updated with assoc
@Francesca-G please review 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.
Here's the design review
Adding follow up required for minor fixes :)
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 work! @briansztamfater 🚀
Thanks for testing @Francesca-G, I've adjusted the icon centering a bit, but the identicon stuff inolves implementing functionality in User Avatar component (and probably the backend) so I will create another issue to track that |
e089f4d
to
ebfb6bf
Compare
Signed-off-by: Brian Sztamfater <brian@status.im>
ebfb6bf
to
8d235f6
Compare
BTW @Francesca-G I'll merge this one, feel free to review the latest build, I'll create a new PR if you find other issues 👍 |
fixes #17387
Summary
Implement Saved Contact Address List Item component
Screenshots
Platforms
Steps to test
status: ready