-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
feat(ui): move more Toast logic #7973
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
Pull Request Overview
This PR centralizes Toast logic into the ui-components
package via a new NotificationProvider
, and renames BaseCodeBox
to a full-feature CodeBox
, updating all related imports and stories.
- Move Toast.Provider and Toast.Viewport into
NotificationProvider
, removing itsviewportClassName
prop. - Rename
BaseCodeBox
toCodeBox
, add a requirednotificationText
prop, and hook intouseNotification
. - Update Storybook previews, component stories, and site code to use the new
NotificationProvider
andCodeBox
API.
Reviewed Changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
packages/ui-components/src/Providers/NotificationProvider.tsx | Hard-coded Toast.Viewport class, removed viewportClassName prop |
packages/ui-components/src/Common/CodeBox/index.tsx | Renamed BaseCodeBox → CodeBox , added notificationText & useNotification |
packages/ui-components/src/Common/CodeTabs/index.stories.tsx | Switched import from BaseCodeBox → CodeBox |
packages/ui-components/src/Common/CodeBox/index.stories.tsx | Updated story types/default export to use CodeBox |
packages/ui-components/.storybook/preview.tsx | Replaced direct Toast.Provider with NotificationProvider |
apps/site/layouts/Base.tsx | Removed now-obsolete viewportClassName prop usage |
apps/site/components/MDX/CodeBox/index.tsx | Updated import to use wrapper BaseCodeBox from ui-components |
apps/site/components/Downloads/Release/ReleaseCodeBox.tsx | Updated import to use wrapper BaseCodeBox from ui-components |
apps/site/components/Common/CodeBox.tsx | Refactored wrapper to drop its own notification logic, use BaseCodeBox from ui-components |
Comments suppressed due to low confidence (2)
apps/site/components/MDX/CodeBox/index.tsx:4
- [nitpick] Aliasing the imported component as
BaseCodeBox
may be misleading since it’s now a full-featured component. Consider renaming the alias toCodeBox
for clarity.
import BaseCodeBox from '#site/components/Common/CodeBox';
packages/ui-components/src/Common/CodeBox/index.tsx:3
- The
DocumentDuplicateIcon
import is no longer used in this file; consider removing it to clean up unused imports.
import {
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## main #7973 +/- ##
==========================================
+ Coverage 73.07% 73.15% +0.07%
==========================================
Files 95 95
Lines 8358 8355 -3
Branches 218 218
==========================================
+ Hits 6108 6112 +4
+ Misses 2249 2242 -7
Partials 1 1 ☔ View full report in Codecov by Sentry. |
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.
LGTM! Have you checked it all works nicely?
Yes. I've verified that it renders properly on:
|
8afb1d1
to
150c7a8
Compare
I realized that, now that we store NotificationProvider in
ui-components
(#7967), we can actually move the styling toui-components
as well.