Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

refactor(site): Refactor alerts#7587

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
BrunoQuaresma merged 13 commits intomainfrombq/refactor-alerts
May 18, 2023
Merged

Conversation

BrunoQuaresma
Copy link
Collaborator

Motivation:
Our alerts were inconsistent when displaying messages with details or actions, looking a bit ugly and unprofessional.

Changes:

  • ChangeAlertBanner toAlert.Alert is our custom component with a few standard features we usually need when displaying errors and warnings.
  • Use the MUI Alert component as a base
  • Create a custom component to deal with errorsErrorAlert. It extends theAlert component and uses thegetErrorMessage andgetErrorDetail to mount the text that will be displayed
  • Do not hide the error details anymore. It was making the component a bit more complex and I don't see a good case for it, but let me know if you think it is essential and what is the use case
  • Added a few error color tweaks
  • Changed the button sizes to improve its usage range

Preview:

Before:
Screen Shot 2023-05-17 at 15 33 37

After:
Screen Shot 2023-05-17 at 15 33 46

Before:
Screen Shot 2023-05-17 at 15 32 51

After:
Screen Shot 2023-05-17 at 15 32 57

Kira-Pilot reacted with hooray emoji
- name: "@mui/material/Alert"
message:
"You should use the Alert component provided on
components/Alert/Alert"
Copy link
Member

Choose a reason for hiding this comment

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

Nice!

rodrimaia reacted with heart emoji
@Kira-Pilot
Copy link
Member

Feels like the icon on the "info" severity alert doesn't have enough contrast:
Screenshot 2023-05-17 at 4 11 36 PM

BrunoQuaresma reacted with thumbs up emoji

@Kira-Pilot
Copy link
Member

Kira-Pilot commentedMay 17, 2023
edited
Loading

I think I was under the mistaken impression that we were going to be using the snackbar from this PR as the new alert widget going forward. Is that just for version updates? When do you think we should use an alert vs a toast vs a snackbar? Asking so I can get it right in my upcoming PR :)

import Button from "@mui/material/Button"

export interface AlertProps extends PropsWithChildren {
severity: MuiAlertProps["severity"]
Copy link
Member

Choose a reason for hiding this comment

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

IfErrorAlert is going to be a separate component, should we omit the severityerror from this prop type? At first glance, it's hard to tell if I should be usingErrorAlert for errors, orAlert withseverity="error" or both in different ways.

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Alert is the generic one with extra things and it should still be usable for errors if you need some customization. The advantage of using theErrorAlert component is, you can pass the error and get the message and detail displayed without having to do it yourself.

Kira-Pilot reacted with thumbs up emoji
severity="error"
text="No authentication methods configured!"
/>
<Alert severity="error">No authentication methods configured!</Alert>
Copy link
Member

Choose a reason for hiding this comment

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

Related to my comment above, what is the difference between these two ways of displaying errors?

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

I answered in the previous comment.

setOpen(false)
onDismiss && onDismiss()
}}
data-testid="dismiss-banner-btn"
Copy link
Member

Choose a reason for hiding this comment

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

Should we stick anaria-label on here?

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Since it has a text, I think we don't need it 🤔 but I'm not sure if I understood your point

Copy link
Member

Choose a reason for hiding this comment

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

No, you're right! I had to google it but I think since we have the text we can forget the label.

@BrunoQuaresma
Copy link
CollaboratorAuthor

I think I was under the mistaken impression that we were going to be using the snackbar from this PR as the new alert widget going forward. Is that just for version updates? When do you think we should use an alert vs a toast vs a snackbar? Asking so I can get it right in my upcoming PR :)

This is a REALLY good question and I'm not sure if I have a good answer for that, but I think snack bars are good for displaying errors or warnings that need to be displayed after a certain action as feedback like an update or delete error after a user clicked on a button.

Alerts are good for static warnings where the users didn't trigger any action like deprecation notices and errors during initial loading but any of these are "written in stone" and we may find situations where display alerts for actions feedback or display snack bars for static warnings can be better, the PR that you mentioned is one of these cases. We didn't have a good place to place the "global alert" so it was just better and easy to make it a snack bar.

Kira-Pilot reacted with thumbs up emoji

@Kira-Pilot
Copy link
Member

Alerts are good for static warnings where the users didn't trigger any action like deprecation notices and errors during initial loading

This seems like a good distinction to me!

BrunoQuaresma reacted with heart emoji

@BrunoQuaresmaBrunoQuaresma merged commit8e31ed4 intomainMay 18, 2023
@BrunoQuaresmaBrunoQuaresma deleted the bq/refactor-alerts branchMay 18, 2023 16:17
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsMay 18, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@Kira-PilotKira-PilotKira-Pilot approved these changes

@rodrimaiarodrimaiaAwaiting requested review from rodrimaia

Assignees

@BrunoQuaresmaBrunoQuaresma

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@BrunoQuaresma@Kira-Pilot

[8]ページ先頭

©2009-2025 Movatter.jp