-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[Alert] Add new component #18094
Comments
@dimitropoulos This would be great! I have kept a small list of implementations I have seen over the last few months: https://trello.com/c/hMM2R1uh/1893-alert-component. |
Great! Then I'll start scoping out the API and features we would want to target. Thankfully there's a good deal to draw on! Once we agree on the general approach for things I will get started on the code. |
@dimitropoulos Great, I have searched a bit some for more benchmark sources:
|
Hi, I just wanted to ask if @dimitropoulos are you still working on it, or I could give it a go? |
Note that the banner component in the Material Design specification is very close to this use case, I think that it's more important to have a solid Alert, but it could be interested to have some sort of an extended support for this component. |
I have some work I did on it, but never pushed it up. @r3dm1ke would you like to work on it together? I'll push what I had now. It took me quite a long time to figure out just how to get the basic moving pieces into the codebase to have a place to start. |
@dimitropoulos That would be awesome, I am just not sure how to work together on the same pull request at the same time. Perhaps we need to split it into two based on what you have already completed (like api/tests/docs etc.)? @oliviertassinari do you have any insights? |
see: #18702 I basically did a lot of the gruntwork associated with just getting the minimal set of things included. I'd be more than happy for you to pick it up and do whatever you wish from here if you'd be alright with me chipping in a few commits as you go. It was much more work than I was anticipating to get the above commit just because of a lack of familiarity with the codebase. That said, I'd really like to get to a point where I can contribute valuable features (such as this) to this project, so if you could lead the way, it would give me a better idea of how development on this project works in practice. Either way: I'm totally cool with whatever. :) |
Also, you're in Toronto and I'm in Michigan, so perhaps our timezones line up well enough to do some pair programming on it some night if you want :) |
I am actually not that experienced myself 😅. I have looked through your changes, could you give we write access to your fork of the repo so we can continue from there? |
oh my apologies! I assumed that you could already write to it! I'll do that real quick :) |
I've just sent both of you invites. I thought the way it worked was that if you have write access on the main repo that you would have access on the fork, but I think that was skewed by my usage of github within a private organization where this holds true. |
Thank you! I did not have write access to the main repo though. Could you send me your email address so we do not clutter this issue? |
@dimitropoulos Thanks for the invitation, I think that the simplest would be to iterate on a single place: I will have a look at the benchmarked components and make a proposal (from a "product" perspective), it's great to have multiple 👀 challenging it. Once we agree on the deliverable, you guys should be able to move forward and see the next steps more clearly :). |
I've wondered occasionally if we should automate it, but then convince myself that there can only be so many more new components. Now I'm not so sure! :) |
<Alert>
<AlertIcon />
<AlertTitle>
Sorry, results couldn't be loaded
</AlertTitle>
<AlertClose />
<AlertDescription>
There was an error while processing your request. Refresh your page for loading results.
</AlertDescription>
<AlertActions>
<Button>
Refresh
</Button>
<Button component="a" href="mailto:[email protected]">
Contact support
</Button>
</AlertActions>
</Alert>
|
👍 🎉 🚀 |
I was wondering should we allow multiple close icons and an ability to override its appearance and/or behavior? There may be a use case when user can either close or snooze the alert. But that may belong in |
@r3dm1ke Without more information, I don't think that we should allow more than one close icon. I think that developers should be able to customize the look of the icon button, or not even render it if needed. Yeah, a snooze button in AlertActions sounds like a valid use case. |
I think that @mbrookes has made a brilliant connection at #18750 (comment). We have a customization example with the Snackbar that we could actually make the |
@oliviertassinari my gut reaction is that this could be great: but on thinking about it for a second I'm less confident because the actual UI behavior of a snackbar (also called toast) is so different (it's fixed position, dismissable with an animation, etc.). That said... I'm not deeply aware of how this project is structured. Just to say it out loud: it seems to me that it's actually the |
@dimitropoulos @oliviertassinari I actually think that |
Yeah, that sounds good to me. As far as the API is concerned I'm open minded but not sure. Consider how the Avatar component, based pretty much entirely on the Chip component, doesn't exactly (via its API) call attention to the fact that it uses Chip under the hood. It basically just feels like a bespoke component. Perhaps we should do the same with Snackbar. At the same time... It could be cool to isolate that Snackbar behavior and give the user the ability to put whatever they want in a Snackbar, kinda like how a Modal/Dialog works. |
From my perspective, the main purpose of the Snackbar component is to handle the complexity of displaying toasts on the screen. So it includes position, animation, stacking, timeout, imperative API. It could come unstyled. @dimitropoulos I don't understand your point regarding the Chip and the Avatar. |
@oliviertassinari I think I misunderstood how to use the Snackbar. I thought it was a ready-made component that comes with styles and all that. My point was that when you use Avatar you don't do: Similarly, we may want to do the same here. Instead of doing |
OK, thanks for the clarification. But notice that the Avatar isn't a wrapper for the Chip component. However, you can provide an Avatar to the Chip component. I think that it would be great to keep the API declarative, close to the underlying DOM node. |
doh Well now.. not sure how I got that impression. Sorry for the confusion :| |
No problem :) |
I drafted out a proposed API for the root Alert component, tell me what you think:
I am not sure though, should we have an |
I would really like if we saw the addition of I, for one (and maybe for all), have had quite a few times where I've wished the palette had a |
I fully agree, but that big of a feature (add new colors to the theme palette and update the |
Yep! that's what I'm trying to say. Start with as few colors as possible for Alert at first (maybe literally only one?) and then add the other colors when the palette improvements land. |
@r3dm1ke I think there's a consensus that we can add these static colours to the theme ahead of any dynamic theme improvements (#18094 (comment) and elsewhere). If they are added as part of this PR, then the work to add them to other components (where appropriate) can be handled separately, and probably incrementally. |
|
@oliviertassinari @dimitropoulos I just pushed a commit that adds |
I think it would be best to do the changes to the palette in another, separate, PR with a separate issue. I was trying to say before that it might be best to implement Alerts (for now) with just one color (primary?) or maybe two (primary + secondary?) to keep it as simple as possible while we nail down the main functionality. I imagine there are other concerns and such that will come up when expanding the palette and therefore it seems prudent to me for other people to be able to weigh in on that feature as it stands. Great head start on the palette stuff, though! |
@dimitropoulos This sounds safer 👍. |
Ok, sounds reasonable, I just misunderstood. Then I will revert the last commit and save it for later |
@r3dm1ke (and anyone else interested) the conversation about theme palette colors is happening in #13875 (comment) |
relevant PR: #18702
I am happy to contribute this component. I am making this issue to determine interest and discuss the scope of the component.
This issue is to track the development in an Alert component. This component provides contextual feedback messages for typical user actions.
Summary 💡
This component provides contextual feedback messages when you need a persistent static container which is closable by user actions or when you need to show alert messages to users.
Examples 🌈
Many libraries have implementations of this:
Alert
ComponentAlert
Alert
ComponentAlert
ComponentAlert
ComponentAlert
ComponentAlert
ComponentAlert
ComponentAlert
ComponentAlert
ComponentAlert
ComponentAlert
ComponentAlert
ComponentAlert
ComponentNotification
ComponentMessage
ComponentBanner
ComponentAlert
ComponentMotivation 🔦
As with the examples above, I have used such a component before in 3 of the above mentioned solutions and find it missing in material-ui.
The text was updated successfully, but these errors were encountered: