-
Notifications
You must be signed in to change notification settings - Fork 0
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
CORE-670 Split ToastContainer into BodyPortalToastContainer and non-body portal version #67
Conversation
Once this is released I'll go through all the Assignable repos and make PRs to update and change |
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 thinking about how we ensure these stay in sync over time.... The inner components are the same so maybe both of these should be thin wrappers around some BaseToastContainer component that handles the map render?
src/components/ToastContainer.tsx
Outdated
}; | ||
|
||
export const BodyPortalToastContainer = ({ toasts, onDismissToast, inline = false, className }: { | ||
toasts: ToastData[], onDismissToast?: ToastData['onDismiss'], inline?: boolean, className?: string |
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.
Can we make both of these a type/interface just so we don't forget these should take the same props
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.
Yeah, good idea
display: grid; | ||
justify-items: center; | ||
justify-content: center; | ||
gap: 1vh; |
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.
This looks like the same css, can we put it into a variable for both?
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 thought about extracting the template string/array and reusing it, but I ran into issues with the types, because I think styled-components uses a generic type that gets some of its values from the template string/array.
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.
Oh, I can probably make a factory function
src/components/ToastContainer.tsx
Outdated
@@ -4,7 +4,19 @@ import { Toast } from './Toast'; | |||
import { zIndex } from '../../src/theme'; | |||
import { ToastData } from '../../src/types'; | |||
|
|||
const StyledToastContainer = styled(BodyPortal)` | |||
const StyledToastContainer = styled.div` |
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.
With this being a regular div again i think you can remove slot='toast'
in the ToastContainer
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.
Good point
DRYed up the ToastContainer code and added types for the interface |
To be used by Rex, which uses ToastContainer but doesn't want portals.