mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Stack: Filter out undefined children (#76617)
This commit is contained in:
@@ -13,9 +13,11 @@ export const Stack = React.forwardRef<HTMLDivElement, React.PropsWithChildren<St
|
||||
({ gap = 1, direction = 'column', children, ...rest }, ref) => {
|
||||
return (
|
||||
<Flex ref={ref} gap={gap} direction={direction} wrap="wrap" {...rest}>
|
||||
{React.Children.map(children, (child) => (
|
||||
<div>{child}</div>
|
||||
))}
|
||||
{React.Children.toArray(children)
|
||||
.filter(Boolean)
|
||||
.map((child, index) => (
|
||||
<div key={index}>{child}</div>
|
||||
))}
|
||||
</Flex>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user