Skip to content

Commit

Permalink
[@mantine/core] Portal: Fix error when value of className prop cont…
Browse files Browse the repository at this point in the history
…ained whitespace (#4935)
  • Loading branch information
rtivital committed Oct 1, 2023
1 parent b936589 commit 670db88
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/mantine-core/src/components/Portal/Portal.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ export function Usage() {
return (
<>
<div id="portal-target" />
<Portal style={{ background: 'pink' }} target="#portal-target">
<Portal style={{ background: 'pink' }} className="class1 class2">
<p>First</p>
</Portal>
<Portal style={{ background: 'pink' }} target="#portal-target">
<Portal style={{ background: 'pink' }}>
<p>Second</p>
</Portal>
</>
Expand Down
2 changes: 1 addition & 1 deletion src/mantine-core/src/components/Portal/Portal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useProps } from '../../core';
function createPortalNode(props: React.ComponentPropsWithoutRef<'div'>) {
const node = document.createElement('div');
node.setAttribute('data-portal', 'true');
typeof props.className === 'string' && node.classList.add(props.className);
typeof props.className === 'string' && node.classList.add(...props.className.split(' '));
typeof props.style === 'object' && Object.assign(node.style, props.style);
typeof props.id === 'string' && node.setAttribute('id', props.id);
return node;
Expand Down

0 comments on commit 670db88

Please sign in to comment.