-
Notifications
You must be signed in to change notification settings - Fork 130
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
Add notification toast #1295
Add notification toast #1295
Conversation
🦋 Changeset detectedLatest commit: 8341e46 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/sumup/oss-circuit-ui/H111VsbR1A825HtetHksevYwJeUS |
Codecov Report
@@ Coverage Diff @@
## main #1295 +/- ##
==========================================
- Coverage 92.25% 92.22% -0.03%
==========================================
Files 186 189 +3
Lines 3681 3770 +89
Branches 1153 1170 +17
==========================================
+ Hits 3396 3477 +81
- Misses 268 275 +7
- Partials 17 18 +1
|
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'm so excited to see this component coming to life. It's very satisfying to see so many existing APIs being reused and seamlessly composed together 🤩
A good chunk of the comments is grammar or typo fixes. Next time, please run documentation or other prose text through Grammarly before requesting reviews on a PR.
packages/circuit-ui/components/NotificationToast/NotificationToast.docs.mdx
Outdated
Show resolved
Hide resolved
packages/circuit-ui/components/NotificationToast/NotificationToast.docs.mdx
Outdated
Show resolved
Hide resolved
packages/circuit-ui/components/NotificationToast/NotificationToast.docs.mdx
Outdated
Show resolved
Hide resolved
packages/circuit-ui/components/NotificationToast/NotificationToast.docs.mdx
Outdated
Show resolved
Hide resolved
packages/circuit-ui/components/NotificationToast/NotificationToast.docs.mdx
Outdated
Show resolved
Hide resolved
packages/circuit-ui/components/ToastContext/ToastContext.spec.tsx
Outdated
Show resolved
Hide resolved
packages/circuit-ui/components/ToastContext/ToastContext.spec.tsx
Outdated
Show resolved
Hide resolved
packages/circuit-ui/components/ToastContext/ToastContext.spec.tsx
Outdated
Show resolved
Hide resolved
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.
Since we paired on the actual feature, and @connor-baer already gave a thorough review, I'm just adding high-level comments here on things we missed (especially related to accessibility).
Also for docs: I think we should make sure that the "Usage in code" section you've added is more prominent: right now the docs start with props, as usual, but several of these props are actually internal. I'm not sure if there's anything we can do to make this clearer (can we show just props that the useToast
takes?) but at least let's emphasise that NotificationToast
should never be used directly anyways
packages/circuit-ui/components/NotificationToast/NotificationToast.tsx
Outdated
Show resolved
Hide resolved
packages/circuit-ui/components/NotificationToast/NotificationToast.docs.mdx
Outdated
Show resolved
Hide resolved
packages/circuit-ui/components/NotificationToast/NotificationToast.tsx
Outdated
Show resolved
Hide resolved
packages/circuit-ui/components/NotificationToast/NotificationToast.tsx
Outdated
Show resolved
Hide resolved
packages/circuit-ui/components/NotificationToast/NotificationToast.tsx
Outdated
Show resolved
Hide resolved
packages/circuit-ui/components/NotificationToast/NotificationToast.docs.mdx
Show resolved
Hide resolved
packages/circuit-ui/components/NotificationToast/NotificationToast.docs.mdx
Outdated
Show resolved
Hide resolved
packages/circuit-ui/components/NotificationToast/NotificationToast.docs.mdx
Show resolved
Hide resolved
packages/circuit-ui/components/NotificationToast/NotificationToast.docs.mdx
Outdated
Show resolved
Hide resolved
Initially the component imitated the Modal. This commit tailors the logic to the context of toasts: the hook doesn't expose a removeToast, the provider doesn't accept initialToasts (use useEffect instead), toasts are dismissed automatically after a default 3000ms, etc.
5e36d91
to
c79b095
Compare
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.
Left lots of smaller comments, but it's looking good! 🙂
packages/circuit-ui/components/NotificationToast/NotificationToast.docs.mdx
Outdated
Show resolved
Hide resolved
packages/circuit-ui/components/NotificationToast/NotificationToast.docs.mdx
Outdated
Show resolved
Hide resolved
packages/circuit-ui/components/NotificationToast/NotificationToast.docs.mdx
Outdated
Show resolved
Hide resolved
packages/circuit-ui/components/NotificationToast/NotificationToast.docs.mdx
Outdated
Show resolved
Hide resolved
packages/circuit-ui/components/NotificationToast/NotificationToast.docs.mdx
Outdated
Show resolved
Hide resolved
packages/circuit-ui/components/NotificationToast/NotificationToast.docs.mdx
Outdated
Show resolved
Hide resolved
packages/circuit-ui/components/NotificationToast/NotificationToast.stories.tsx
Outdated
Show resolved
Hide resolved
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.
Thanks so much, this looks great! Let's move forward and address the minor follow-ups we talked about early in 2022 🥳
Addresses #792.
Purpose
Introduces the new NotificationToast component.
The notification toast component non-disruptively provides quick, contextual or feedback based on the outcome of an action.
It comes in 4 variants, "info", "confirm", "notify" and "alert".
To communicate a message always provide a body copy, and if needed an optional headline can be included above the body copy.
The notification toast floats above the content, positioned at the bottom of the screen, centralized horizontally withing the content area.
The auto-dismiss duration is adjustable (default minimum duration is 3000 ms).
Toasts can also be dismissed by clicking on a close button in the top-right corner. You need to provide closeButtonLabel.
Approach and changes
Refer to the Storybook for further implementation and usage guidelines, and to the threads below for more details and discussion on the implementation.
Definition of done