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: Update <Alert> style #12422

Merged
merged 12 commits into from
Jan 23, 2025
Merged

feat: Update <Alert> style #12422

merged 12 commits into from
Jan 23, 2025

Conversation

mydea
Copy link
Member

@mydea mydea commented Jan 22, 2025

This updates the style of the <Alert> component according to new designes from @Jesse-Box .

This also re-introduces the succeess level

Before:

Screenshot 2025-01-22 at 11 09 36

Afterwards:

image

The <Note> component is now just an alias for <Alert> without a title, it will be removed in a follow up.

@mydea mydea self-assigned this Jan 22, 2025
Copy link

vercel bot commented Jan 22, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
develop-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 23, 2025 1:31pm
sentry-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 23, 2025 1:31pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
changelog ⬜️ Ignored (Inspect) Visit Preview Jan 23, 2025 1:31pm

Copy link

codecov bot commented Jan 22, 2025

Bundle Report

Changes will increase total bundle size by 11.14kB (0.06%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
sentry-docs-server-cjs 10.39MB 7.35kB (0.07%) ⬆️
sentry-docs-client-array-push 9.3MB 3.79kB (0.04%) ⬆️
View changes by path for bundle: sentry-docs-server-cjs
File path Size Change
/[[...path]] 514.67kB 252 bytes (0.05%)

@stephanie-anderson
Copy link
Contributor

@Jesse-Box

  • Do we only plan to have info and warning, or other levels as well (success, error)? If we could prepare for that would be amazing!
  • I think the contrast for the info one is really low, could we increase that somehow?

@Jesse-Box
Copy link
Contributor

Jesse-Box commented Jan 22, 2025

  • I think the contrast for the info one is really low, could we increase that somehow?

I'm up for increasing the contrast, but I need a bit of guidance as to what colours we could use because I dont want to come up a magic colour value.

  • Do we only plan to have info and warning, or other levels as well (success, error)? If we could prepare for that would be amazing!

@mydea and I checked the codebase for error levels, but could find anything.

@mydea
Copy link
Member Author

mydea commented Jan 22, 2025

yeah, we did not use success at all, and danger in very few places, so I dropped these here: #12418 - we can always add them back if needed, but IMHO the difference between warning & danger is slim/not 100% clear, so it's fine to just have info & warning from my POV!

I can try to use an even lighter background!

@mydea
Copy link
Member Author

mydea commented Jan 22, 2025

I could mix the background colors with transparency (TIL I learned about https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/color-mix, really cool!). E.g. mixed with 10% transparency:

image

@mydea
Copy link
Member Author

mydea commented Jan 22, 2025

So I re-added success level here:

image

cc @inventarSarah we need to define when to use these 🤔

@mydea
Copy link
Member Author

mydea commented Jan 22, 2025

Another update to the design:

image

Copy link
Contributor

@stephanie-anderson stephanie-anderson left a comment

Choose a reason for hiding this comment

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

Oh, we still need to address the dark mode before merging

Screenshot 2025-01-22 at 18 07 23

@mydea mydea force-pushed the fn/update-alert-style branch from 1e1ddf9 to e19709a Compare January 23, 2025 08:08
@mydea
Copy link
Member Author

mydea commented Jan 23, 2025

ah, great catch! Latest update, I changed the colors slightly to use existing color vars that also have dark mode variants:

Screenshot 2025-01-23 at 09 05 17

vs

Screenshot 2025-01-23 at 09 05 20

const Icon = ICON_MAP[level];

if (!Icon) {
throw new Error(`Invalid alert level: "${level}" passed to Alert component`);
Copy link
Member Author

Choose a reason for hiding this comment

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

@chargome what is your opinion on this? I opted to error out if an invalid level is passed in. this way, you'll know and the build will fail if you do this.

Alternatively, we would have to check the level and fall back to info if something invalid is passed in 🤔 I think it is more helpful to error there, as we def. had cases where users passed in invalid stuff and possibly did not even notice it. But happy to defer to your POV on this here!

Copy link
Member

Choose a reason for hiding this comment

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

Yeah throwing in the build makes sense to me when working with MDX 👍

Copy link
Member

@chargome chargome left a comment

Choose a reason for hiding this comment

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

Looks sharp, left a comment on colors but feel free to merge!

src/components/alert/styles.scss Show resolved Hide resolved
src/components/alert/styles.scss Outdated Show resolved Hide resolved
Copy link
Contributor

@stephanie-anderson stephanie-anderson left a comment

Choose a reason for hiding this comment

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

great, thank you @mydea !!

@mydea mydea merged commit 81c0f52 into master Jan 23, 2025
13 checks passed
@mydea mydea deleted the fn/update-alert-style branch January 23, 2025 15:01
@inventarSarah
Copy link
Collaborator

The new alerts look really really good!! ♥

I'll update the Contributing to the Docs with information on how and when to use these (#12466)

Re the "Danger" alert:
I agree with @mydea: we can always add it back when needed.
For example, you would use the "danger" type to warn users of actions that could lead to data loss or other serious consequences that are difficult to reverse and potentially cause damage.

@inventarSarah inventarSarah mentioned this pull request Jan 27, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Feb 12, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants