Skip to content

Commit

Permalink
refactor: rename to slottedChildren for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan committed Dec 12, 2023
1 parent d98590f commit 6dfb591
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ function Select(props: SelectProps, ref: ForwardedRef<SelectElement>): ReactElem
const children = Array.isArray(props.children) ? props.children : [props.children];

// Components with slot attribute should stay in light DOM.
const slotted = children.filter((child): child is ReactNode => {
const slottedChildren = children.filter((child): child is ReactNode => {
return isValidElement(child) && child.props.slot;
});

// Component without slot attribute should go to the overlay.
const overlayChildren = children.filter((child): child is ReactNode => {
return isValidElement(child) && !slotted.includes(child);
return isValidElement(child) && !slottedChildren.includes(child);
});

const renderFn = children.find((child) => typeof child === 'function');
Expand All @@ -56,7 +56,7 @@ function Select(props: SelectProps, ref: ForwardedRef<SelectElement>): ReactElem

return (
<_Select {...props} ref={finalRef} renderer={renderer}>
{slotted}
{slottedChildren}
{portals}
</_Select>
);
Expand Down

0 comments on commit 6dfb591

Please sign in to comment.