-
Notifications
You must be signed in to change notification settings - Fork 146
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: balance skeleton loader #5126
Conversation
e438479
to
0860254
Compare
53a8b08
to
09f6c8d
Compare
src/app/components/crypto-assets/crypto-currency-asset/crypto-currency-asset-item.layout.tsx
Outdated
Show resolved
Hide resolved
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 some suggestions but overall good work and I like the shimmer 👍
import { css } from 'leather-styles/css'; | ||
import { Box } from 'leather-styles/jsx'; | ||
|
||
export function BalanceShimmer({ ...rest }) { |
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.
Needs types
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.
Also, this is the skeleton loader? Can we call it skeleton instead? Shimmer makes me think it's just the text effect
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.
Also why does this need to be specific to balances? What if we need a skeleton loader for other non-balance text?
Suggest we make a skeleton design system component, with stories, rather than having a specific balance one. This component could wrap 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, will rename to Skeleton loader. I actually added already some stories.
how you see this skeleton design system component
? what should it take as props except width/height?
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.
src/app/components/crypto-assets/crypto-currency-asset/crypto-currency-asset-item.layout.tsx
Outdated
Show resolved
Hide resolved
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.
Think it's important to not make this component specific to balance. Thoughts?
import { css } from 'leather-styles/css'; | ||
import { Box } from 'leather-styles/jsx'; | ||
|
||
export function BalanceShimmer({ ...rest }) { |
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.
Also why does this need to be specific to balances? What if we need a skeleton loader for other non-balance text?
Suggest we make a skeleton design system component, with stories, rather than having a specific balance one. This component could wrap that?
Please link to a relevant issue and place that issue on the board 🙏 |
09f6c8d
to
1e6ce1a
Compare
e0830c2
to
0f620f0
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.
SkeletonLoader component looks good, but think it's really important not to break the conceptual divide between a generic component, and an instance of its use.
accountItemTotalBalance: { | ||
height: '20px', | ||
}, | ||
cryptoAssetItemTokenBalance: { | ||
width: '126px', | ||
}, | ||
cryptoAssetItemUsdBalance: { | ||
width: '78px', | ||
}, | ||
accountCardTotalBalance: { | ||
width: '200px', | ||
height: '38px', | ||
}, |
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.
This breaks separation of concerns. A generic component like this shouldn't know about all these specific use-cases within the wallet. Will list just grow every new use we have? IMO this is a really important rule not to break, and easy to avoid. Also, think how we want to refactor this to monorepo. Extension-specific UI concerns shouldn't be there either.
Why not make it configurable by passing width/height. Or, perhaps better, given that the skeleton loader is there to replace areas of text, why not pass the textStyle
that it's masking and infer the height from that? And also pass a length for how many chars long it should be?
<SkeletonLoader textStyle="header.01" textLength={20} />
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 made this to avoid duplication of width/height passing in components and stories.
maybe just put it to separate file? and yeah, just pass these styles in components to loader
I believe this textStyle
approach is not extendable here as skeleton loader might be used not only for text
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 you're right, let's skip the textstyle approach, as we don't want to assume it's only used for text.
To avoid the duplication, we should make wrapper components
AccountCardSkeletonLoader
contains SkeletonLoader
with some predefined widths and heights. That's a more flexible approach than baking in these concerns to the loader 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.
don't think we need any additional wrapper either. just pass width/height and that's it.
do we really need add to stories all skeleton usage variants?
0f620f0
to
d0fd13a
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.
LGTM
Was this already fixed? @alter-eggo you mentioned creating a new PR, I only see this one. I see the loader for balances in this build but not for BNS names/account names on the switch select account screen. Loading all the names on an account with hundreds of names looks good here! |
@314159265359879 seems there was problem with shimmer styles which fixed here #5205 |
@markmhendrickson it's quite an old pr, pls check #5206 |
This pr adds skeleton loader for balances on home page and switch account modal
https://github.com/leather-wallet/extension/assets/46521087/492e7c7f-49b4-446d-b99e-f25c1d080bda