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

Clean up discover alerts #51842

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Clean up discover alerts #51842

wants to merge 11 commits into from

Conversation

zmb3
Copy link
Collaborator

@zmb3 zmb3 commented Feb 4, 2025

Discover was using a custom HintBox component instead of the in-page alerts that are part of our design system. As a result, some items rendered without enough contrast. Use the new alert component to ensure consistency across the UI.

Example after/before:

Screenshot 2025-02-04 at 11 50 18 AM

Other changes:

  • Use unordered lists instead of manually including a - character to emulate a bullet.
  • Top-align the icon in alerts with large amounts of vertical content.

Before:
image

After:
image

@zmb3 zmb3 requested a review from kimlisa February 4, 2025 19:56
@github-actions github-actions bot requested review from ravicious and rudream February 4, 2025 19:56
@zmb3 zmb3 added no-changelog Indicates that a PR does not require a changelog entry backport/branch/v15 backport/branch/v16 backport/branch/v17 labels Feb 4, 2025
Discover was using a custom HintBox component instead of the in-page
alerts that are part of our design system. As a result, some items
rendered without enough contrast. Use the new alert component to
ensure consistency across the UI.
@zmb3 zmb3 force-pushed the zmb3/discover-dialogs branch from 4befbfa to ffd17ee Compare February 4, 2025 21:32
Copy link
Contributor

@kimlisa kimlisa left a comment

Choose a reason for hiding this comment

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

thanks for the clean up

@@ -302,6 +302,7 @@ const IconContainer = styled.div<{ kind: AlertKind }>`
border-radius: 50%;
line-height: 0;
margin-right: ${p => p.theme.space[3]}px;
align-self: flex-start;
Copy link
Member

Choose a reason for hiding this comment

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

Top-align the icon in alerts with large amounts of vertical content.

I wanted to do the same thing, but I don't think you can just change IconContainer like this, as it'll affect all alerts across the whole app. Those that are supposed to be on a single line are going to look off (e.g. https://localhost:9002/?path=/story/design-alerts--actionable).

This needs to be configurable on a per-alert basis.

Copy link
Member

@ravicious ravicious Feb 6, 2025

Choose a reason for hiding this comment

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

My solution keeps the original placement of the icon for other alerts.

Zac's Rafał's
zacs rafals

I added alignItems which allows you to align both the icon and the action buttons to the top. I'm going to need it in VNet diagnostics anyway. Would using it work for you in Discover?

I also added a story with controls for Alert so that it's easier to test different variants.

Copy link
Member

Choose a reason for hiding this comment

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

Oops, I didn't know you talked with Bartosz about this. I still think it might be best to change only the Discover alerts for now?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Your solution seems fine, but I am confused at the state of things now that you've pushed to my branch.

Are we good to go now on this issue or are more changes required?

Copy link
Member

Choose a reason for hiding this comment

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

You'd need to add alignItems="flex-start" to relevant alerts in Discover where the icon should be aligned to the top. I suppose every warning that used to use HintBox should now be <Warning alignItems="flex-start">.

@zmb3 zmb3 force-pushed the zmb3/discover-dialogs branch from f153423 to 87f8c0f Compare February 11, 2025 15:36
@public-teleport-github-review-bot public-teleport-github-review-bot bot removed the request for review from rudream February 11, 2025 16:16
Comment on lines 264 to 268
// By default, <a> within an Alert has white color which has bad contrast on certain kinds of
// alerts, like Warning for example. This is an attempt to at least make them visible using the
// same color as the text.
& ${Link}, & a {
color: inherit;
Copy link
Member

Choose a reason for hiding this comment

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

Ugh, I can't do this without risking breaking someone's UI if we ever used something like <ButtonPrimary as="a"> within an alert.

Copy link
Member

Choose a reason for hiding this comment

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

Fixed by specifically checking against <Button>.

Copy link
Member

Choose a reason for hiding this comment

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

I didn't notice that in OuterContainer we hardcode links to theme.colors.light, which is something last touched 6 years ago. I just changed it to color: inherit instead.

Relevant stories:

I couldn't use the same color as Link, as it looks bad with the BBLP theme.

Copy link
Member

Choose a reason for hiding this comment

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

@kimlisa Could you double check me here?

Link.displayName = 'Link';

const StyledButtonLink = styled.a.attrs({
const Link = styled.a.attrs({
Copy link
Member

Choose a reason for hiding this comment

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

This change can stay, <StyledButtonLink> was unnecessarily wrapped in Link instead of being exported directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants