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

fix: update UserHub transactions to have correct styles for 720-768px screen #3446

Merged
merged 1 commit into from
Oct 30, 2024

Conversation

Nortsova
Copy link
Contributor

Description

For 720-768px error message was broken:
image

I really hope that my fix will not break anything else, but all I tested now works 😄

Testing

  • Step 1. Login with MetaMask
  • Step 2. Create Simple payment motion
  • Step 3. Reject transaction
  • Step 4. Open UserHub -> Transactions and ensure that all screens looks good
image image image image

Resolves #3056

@Nortsova Nortsova requested review from a team as code owners October 23, 2024 19:33
@Nortsova Nortsova self-assigned this Oct 23, 2024
Copy link
Contributor

@iamsamgibbs iamsamgibbs left a comment

Choose a reason for hiding this comment

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

This fixes transactions with long error messages:

Screenshot 2024-10-24 at 09 47 29

But short ones are aligned centre:

Screenshot 2024-10-24 at 09 46 32

And it breaks notification banners in a bunch of places unfortunately:

Screenshot 2024-10-24 at 09 44 09 Screenshot 2024-10-24 at 09 47 45

The notification banner is used in a bunch of different places so you'll have to be careful with the changes here:

Screenshot 2024-10-24 at 09 37 31

I found the original PR where this change was made #1381 so the reasoning for it is a bit clearer.

@@ -40,7 +40,7 @@ const NotificationBanner: FC<NotificationBannerProps> = ({
})}
/>
) : null}
<div className="flex flex-1 flex-col items-start gap-2 @[600px]/notificationBanner:flex-row @[600px]/notificationBanner:items-center">
<div className="flex flex-1 flex-col items-start gap-2 @[600px]/notificationBanner:items-center">
Copy link
Contributor

@rumzledz rumzledz Oct 24, 2024

Choose a reason for hiding this comment

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

This is just a humble suggestion @Nortsova -- to save you the hassle since this seemingly affects other areas where we use this NotificationBanner component, maybe you can add a prop for this component and adjust these styles specifically for the GroupedTransactionContent, which contains this problematic NotificationBanner version

And because we know your style changes are definitely fixing the issue, we can try:

<div
  className={clsx(
    'flex flex-1 flex-col items-start gap-2 @[600px]/notificationBanner:flex-row @[600px]/notificationBanner:items-center',
    contentClassName,
  )}
>

Then in GroupedTransactionContent:

<NotificationBanner
  ...existingProps
  contentClassName="@[600px]/notificationBanner:flex-col" // <<-- Add me 😄 
>

Copy link
Contributor

Choose a reason for hiding this comment

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

Then later down the line, maybe we can start thinking about whether it's worth refactoring component entirely

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you @rumzledz , I decided to go with this approach. 🙌

After some investigation, I realized that this issue arises because:

  1. There's a rule for a container width of 600px (only for 720-768px does the container width become larger).
  2. In UserHub, we have a callToAction prop containing two buttons that attempt to fill the full width.

An alternative solution I considered is to remove the callToAction from the component entirely.
And instead of this:

<NotificationBanner
 ...existingProps
  callToAction={<Buttons />}
>

Do something like:

<NotificationBanner
 ...existingProps
>
   {....content}
   <Buttons>
</NotificationBanner>

but this case requires me to fix a lot of styles.

@Nortsova Nortsova force-pushed the fix/3056-user-hub-error-styles branch from 0515e38 to bf13baa Compare October 28, 2024 21:08
@Nortsova Nortsova force-pushed the fix/3056-user-hub-error-styles branch from bf13baa to 3e17b4b Compare October 28, 2024 21:13
@Nortsova
Copy link
Contributor Author

Thank you, @iamsamgibbs and @rumzledz, for reviewing! It’s crucial to update this component without impacting other areas where it’s used. 🙌

Copy link
Contributor

@rumzledz rumzledz left a comment

Choose a reason for hiding this comment

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

Retested and all good on my side @Nortsova

all good anastasiia

Copy link
Contributor

@iamsamgibbs iamsamgibbs left a comment

Choose a reason for hiding this comment

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

Nice job fixing this up, all looks good now!

Screenshot 2024-10-29 at 10 19 30 Screenshot 2024-10-29 at 10 20 20 Screenshot 2024-10-29 at 10 20 48 Screenshot 2024-10-29 at 10 22 54

I agree with you that this should probably be refactored at some point so the content / call to action can just be composed in which would give us more flexibility, but appreciate that would be a much bigger change and this works well for now.

Copy link
Member

@rdig rdig left a comment

Choose a reason for hiding this comment

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

All good now.

Screenshot from 2024-10-29 18-25-10

Screencast.from.2024-10-29.18-25-46.mp4

@Nortsova Nortsova merged commit 5fbfbf9 into master Oct 30, 2024
4 of 6 checks passed
@Nortsova Nortsova deleted the fix/3056-user-hub-error-styles branch October 30, 2024 10:16
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.

UserHub Transactions Errors Styles Break on Medium Viewport Width
4 participants