Update main-quote-summary designs/styles#9612
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
1ebe3a1 to
d33a03c
Compare
Builds ready [d33a03c]
Page Load Metrics (406 ± 51 ms)
|
| name={destinationSymbol} | ||
| fallbackClassName="main-quote-summary__icon-fallback" | ||
| /> | ||
| <span>{ destinationSymbol }</span> |
There was a problem hiding this comment.
can we add a className to these spans so that the scss can target them by a classname and not by an element type? Hopefully, that would lead to more easily understanding of the CSS when coming back to it/new dev onboarding.
| destinationSymbol={destinationTokenSymbol} | ||
| isBestQuote={isBestQuote} | ||
| sourceIconUrl={selectedFromToken.iconUrl} | ||
| destinationIconUrl={destinationToken.iconUrl} |
There was a problem hiding this comment.
Is iconUrl on tokens something added by swaps or did that exist prior?
There was a problem hiding this comment.
It's part of swaps tokens, but not other tokens in the app. You can see it on the objects returned by https://api.metaswap.codefi.network/tokens
There was a problem hiding this comment.
This will expose the user's IP address to the server hosting the token icon URL. This is why we bundle the icon with the extension for the list we have now
Builds ready [e3841a2]
Page Load Metrics (513 ± 62 ms)
|
|
This needs to be rebased - there is a conflict. |
Gudahtt
left a comment
There was a problem hiding this comment.
Presumably this wasn't supposed to look like this:
- It looks like it tries to use the "fallback" for ETH, instead of using the Ethereum logo as we do elsewhere
- The logo for USDC is being fetched successfully (confirmed via the network tab), but it's still not shown for some reason
- We're using the URL returned by the swaps API for USDC and fetching the logo despite already having another copy of the icon bundled with the extension
- The padding between the logo and the symbol looks wrong for the source token
- The fallback letter is off-center
- In the designs the destination token is bolded, but here it is not
|
Thanks @Gudahtt. Regard "We're using the URL returned by the swaps API for USDC and fetching the logo despite already having another copy of the icon bundled with the extension" The preference is to use the url from the swaps API because those icons are up to date. Many of the icon's bundled with our extension are outdated. |
e3841a2 to
e3d10b9
Compare
Builds ready [e3d10b9]
Page Load Metrics (484 ± 65 ms)
|
|
This is looking amazing! Just a couple minor visual spacing tweaks.
We've also updated the styling of the "New quotes in" counter. It's now in a container with a gray background to help separate it from the quote text. Not sure if that will be part of a different PR but wanted to call it out. The designs showing that are here: https://www.figma.com/file/fDtda1cs3MmPXw1MgKswZc/Development-MetaSwaps?node-id=1315%3A843 |
| if (fontSizeScore > 20) { | ||
| ellipsedAmountToDisplay = `${amountToDisplay.slice(0, amountToDisplay.length - (fontSizeScore - 20))}...` | ||
| if (amountDigitLength > 20) { | ||
| ellipsedAmountToDisplay = `${amountToDisplay.slice(0, 20)}...` |
There was a problem hiding this comment.
So this is a pre-existing, but... it looks like the amount here is being manually ellipsed, and then we're using JavaScript to create a tooltip for the full value.
The browser is already much better at this than we are. We could instead use text-overflow: ellipsis; for the ellipses, and use the HTML title attribute for the tooltip. This would be faster, simpler, and more accessible. Was this option considered and ruled out for some reason?
There was a problem hiding this comment.
So this is partly a left over of the previous designs, that had a symbol on the same line as the amount. Doing this with javascript was done for two reasons. First, toproperly control spacing between the amount and the symbol, and the width of each, adding the ellipsis with javascript with necessary. (This is related to trailing space that comes with an ellipsis, but moreover that width has to be constrained with px for ellipsis to work)
Now that the designs have changed, those issues are no longer present. But the second problem is that the designs want the same amount of vertical space between the destination symbol (eth in your screenshots) and the amount. The designs also call for different font sizes depending on the length of the string. When font size changes, the line-height changes, and line height adds extra space above the font. The amount of extra space it adds increase with line height. We address that issue by setting the line height for each font size with javascript. And if line height is set small enough relative to font-size, then the overflow: hidden property required for text-overflow: ellipsis to work will vertically cut off some of the text
(fyi, here is an article that discusses the issues with line-height: https://css-tricks.com/how-to-tame-line-height-in-css/, here is the approach they recommend, which also requires javascript manipulation of the line-height and related properties https://github.com/michaeltaranto/basekick/blob/master/index.js... I am not sure if we can do any better in that regard)
There was a problem hiding this comment.
The height adjustment seems independent of the length though. I understand that we'll have to use JavaScript to adjust the height as content changes, but I think we could still use CSS/HTML for the ellipsis and tooltip. Or am I misunderstanding something still?
There was a problem hiding this comment.
You might be missing something, or maybe I am...
And if line height is set small enough relative to font-size, then the
overflow: hiddenproperty required for text-overflow: ellipsis to work will vertically cut off some of the text
So for ellipsis to work, we have to set overflow: hidden, and if we do that, we hide part of the font that is outside the boundaries of the small line height we set
There was a problem hiding this comment.
unless maybe if we manipulate the height of the container as well...
There was a problem hiding this comment.
Ah, that explains it. I had mistakenly thought you were saying that the height of the container was already being manipulated, but it is not.
There was a problem hiding this comment.
I do thing we'd be better off making this improvement but it can wait for a future PR
yes
that's a pre-existing issue on develop (that shows up when that top warning is there). It will go away when both this PR and #9629 are merged into develop |
e3d10b9 to
f9e258b
Compare
|
@jakehaugen @Gudahtt I have improved some of the vertical spacing issues that were mentioned above. I have also rebased so that the ETH logo is appearing correctly |
Builds ready [92babbf]
Page Load Metrics (448 ± 62 ms)
|
|
@jakehaugen The tweak to spacing has been added to this PR |
Builds ready [b8d2d56]
Page Load Metrics (530 ± 131 ms)
|










This PR updates the UI/styles of the main-quote-summary component to match the latest designs:
https://www.figma.com/file/fDtda1cs3MmPXw1MgKswZc/Development---MetaSwaps?node-id=1247%3A0
A demo video of how the component now behaves with different amount and symbol lengths: https://streamable.com/9znvxd