-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Refactor NotificationsService to not accept React components #36425
Comments
Pinging @elastic/kibana-platform |
Should we discuss creating a common interface that will be used for all plugin integration points with platform UI? Would be also great to use that for app icon instead of implementing |
I'd like to suggest we continue to support the existing interface, but enhance it (without introducing breaking changes) to enable a similar level of control over the toast for consumers that use other frameworks or no framework at all. Here's my line of thought...
Using toast notifications as an example, I'd suggest adding additional config parameters to support arbitrary rendering to the toast's title and text areas. This way the consumer can customize those things just like React code can, but without needing React. Something like this: toasts.add({
onAdd: ({ title, text}) => {
// These are just DOM nodes so you can do anything with them.
text.appendElement(toastBody);
}),
onRemove: ({ title, text }) => {
// We'll probably need to support cleanup logic as well.
}),
}); |
This and #37894 feels like the same discussion to me. Please see #37894 (comment) |
The current Toast type is the following: type toast = {
text?: ReactChild;
toastLifeTimeMs?: number;
title?: ReactNode;
color?: ToastColor;
iconType?: IconType;
onClose?: () => void;
} with nested types being type ReactChild = ReactElement | ReactText;
type IconType = EuiIconType | string | ReactElement;
type ReactNode = ReactChild | ReactFragment | ReactPortal | boolean | null | undefined; The /**
* A function that will mount the banner inside the provided element.
* @param element the container element to render into
* @returns a {@link UnmountCallback} that unmount the element on call.
*
* @public
*/
export type MountPoint = (element: HTMLElement) => UnmountCallback;
/**
* A function that will unmount the element previously mounted by
* the associated {@link MountPoint}
*
* @public
*/
export type UnmountCallback = () => void; (same as in #48431) However, not sure what to do about |
Kibana version: 8.0.0
Describe the bug: New platform accepts React components for toast notifications.
Steps to reproduce:
Expected behavior: New platform should be library agnostic.
The text was updated successfully, but these errors were encountered: