Skip to content
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(ui): updates for address view #1941

Merged
merged 5 commits into from
Dec 10, 2024
Merged

feat(ui): updates for address view #1941

merged 5 commits into from
Dec 10, 2024

Conversation

TalDerei
Copy link
Contributor

@TalDerei TalDerei commented Dec 10, 2024

aligns Address View V2 UI component with the latest figma designs – review the storybook preview link. Some pointers would be helpful cc @VanishMax

@TalDerei TalDerei self-assigned this Dec 10, 2024
Copy link

changeset-bot bot commented Dec 10, 2024

🦋 Changeset detected

Latest commit: 0055896

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@penumbra-zone/ui Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Dec 10, 2024

Visit the preview URL for this PR (updated for commit 0055896):

https://penumbra-ui-preview--pr1941-address-view-v2-iyhu8fit.web.app

(expires Tue, 17 Dec 2024 20:23:10 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 709d729610ef7a6369b23f1cb2b820a60cc685b1

Comment on lines 105 to 107
const truncateClass = truncate
? cn('truncate max-w-[150px] overflow-hidden whitespace-nowrap')
: ''; // Adds max-width for aggressive truncation
Copy link
Contributor Author

@TalDerei TalDerei Dec 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what defines the truncation property's max width?

Screenshot 2024-12-10 at 10 47 16 AM

</Text>
) : (
<Text technical truncate>
<Text technical truncate={truncate}>
{encodedAddress}
</Text>
)}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the copy button below has some stylistic inconsistencies. It displays different styles for sparse and compact densities, and it is also getting cut off. Should this be addressed at the button component level, or by adjusting the wrapping div tag to reduce its size?


Screenshot 2024-12-10 at 10 47 01 AM Screenshot 2024-12-10 at 10 47 08 AM

Copy link
Contributor

@VanishMax VanishMax Dec 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be fine in the real app, it's the Storybook that cuts the block. Could be solved by adding padding in the Storybook story around AddressView

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

padding fixes it 👍

return (
<div className='flex items-center gap-2 text-text-primary'>
<div className={cn(getFont(density))}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: this class doesn't apply to actual text. It applies to the wrapping div, but the Text component has more important styles that are applied. It would be best to apply the font classes using the props to Text component.

For example, in the image below Figma-generated CSS shows that we should use small prop of the Text for compact density.

Screenshot 2024-12-10 at 22 54 12
<Text small truncate={truncate}>

Copy link
Contributor Author

@TalDerei TalDerei Dec 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense, was questioning whether it only applied to wrapping div – will modify accordingly

'Sample opaque address view': ADDRESS_VIEW_OPAQUE,
'Decoded: main-account address view': ADDRESS_VIEW_DECODED,
'Decoded: sub-account address view': ADDRESS1_VIEW_DECODED,
'Opaque: account address view': ADDRESS_VIEW_OPAQUE,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

praise: thanks for covering all style cases in the docs 👍

@@ -102,7 +102,9 @@ const getTextOptionClasses = ({
break: breakProp,
whitespace,
}: TextProps): string => {
const truncateClass = truncate ? cn('truncate') : '';
const truncateClass = truncate
? cn('truncate max-w-[150px] overflow-hidden whitespace-nowrap')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: the max-w-[150px] class would break many of existing components. Truncation width is generally defined in the parent component.

also, truncate class applies both overflow-hidden and whitespace-nowrap under the hood

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ll move the truncation width to the parent component. Moving forward, I’ll focus on applying styling at the parent level where possible to avoid introducing breaking changes to existing components.

@TalDerei TalDerei requested review from a team and VanishMax December 10, 2024 19:49
Copy link
Contributor

@VanishMax VanishMax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Need to somehow fix the linting issues, and it's good to go

Comment on lines +65 to +73
<Text strong-bold truncate={truncate}>
{isRandomized && 'IBC Deposit Address for '}
{getAccountLabel(addressIndex.account)}
</Text>
) : (
<Text small truncate={truncate}>
{isRandomized && 'IBC Deposit Address for '}
{getAccountLabel(addressIndex.account)}
</Text>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: this makes me think of creating an alternative prop that would simply accept a string

@TalDerei TalDerei merged commit 7af1ec8 into main Dec 10, 2024
8 checks passed
@TalDerei TalDerei deleted the address-view-v2 branch December 10, 2024 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants