-
Notifications
You must be signed in to change notification settings - Fork 2
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
Pass toast message through props #9
Conversation
✅ Deploy Preview for enn-graphiql ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
{/* TODO: I'm not quite sure if this is the best public API. */} | ||
<Toast | ||
open={!!toast} | ||
severity={toast?.severity || 'error'} | ||
title={toast?.title || ''} | ||
action={toast?.action} | ||
description={toast?.description} | ||
onClose={() => { | ||
toast?.onClose?.() | ||
setToast(undefined) | ||
}} | ||
/> | ||
</> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to go back to the Toast after shipping the Playground anyway, so... this might change and look better in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make sure I understand, does @edgeandnode/component
use the ToastProvider
from radix-ui? Like is that wrapped in the <ThemeProvider>
we expose? So any app could use the toast message? cc @benface
I just checked and no. Reading the Radix docs, you're right that it seems like we should add that. @hasparus – It works without it? Maybe it's needed for accessibility? |
@benface @cmwhited Currently |
We're now expecting the user to handle displaying messages with a Toast component compatible with
@edgeandnode/components
.Previous GraphiQL Playground we've used had its own snackbar implementation, but @cmwhited convinced me this is a responsibility of the host application. Same toast component should be displayed to communicate network errors.
To support this, we can notice that
@radix-ui/react-toast
exports a context provider to wrap the whole application: