+
{onDismiss && (
layoutRef.current?.dismiss()}
Icon={IconCloseRegular}
- aria-label="Close drawer"
+ aria-label={texts.modalClose || t(tokens.modalClose)}
type="neutral"
backgroundType="transparent"
/>
)}
{title && (
-
+
- {title}
+ {title}
)}
+
+
- {subtitle && {subtitle}}
+ {subtitle && (
+
+ {subtitle}
+
+ )}
{description && (
-
+
{description}
)}
{children}
+
+
{hasButtons && (
{button.text}
- ) : undefined
+ )
}
secondaryButton={
- secondaryButton ? (
+ secondaryButton && (
{secondaryButton.text}
- ) : undefined
+ )
}
link={
- buttonLink ? (
+ buttonLink && (
{buttonLink.text}
- ) : undefined
+ )
}
/>
)}
-
+
);
};
diff --git a/src/portal.tsx b/src/portal.tsx
index 78473c9f5..75a6225c0 100644
--- a/src/portal.tsx
+++ b/src/portal.tsx
@@ -20,29 +20,22 @@ export const Portal = ({children, className}: Props): JSX.Element | null => {
const [container, setContainer] = React.useState
(null);
React.useEffect(() => {
- if (!container) {
- const newContainer = document.createElement('div');
- newContainer.style.isolation = 'isolate';
- setContainer(newContainer);
- document.body.appendChild(newContainer);
- }
+ const newContainer = document.createElement('div');
+ newContainer.style.isolation = 'isolate';
+ setContainer(newContainer);
+ document.body.appendChild(newContainer);
return () => {
- if (container) {
- document.body.removeChild(container);
- }
+ document.body.removeChild(newContainer);
};
- }, [container]);
+ }, []);
React.useEffect(() => {
- if (container && className) {
- container.classList.add(...className.split(' '));
- }
+ const classes = className?.split(' ') || [];
+ container?.classList.add(...classes);
return () => {
- if (container && className) {
- container.classList.remove(...className.split(' '));
- }
+ container?.classList.remove(...classes);
};
}, [className, container]);