Skip to content

Commit

Permalink
fix: use empty state in ResourceList.Body when children is boolean false
Browse files Browse the repository at this point in the history
  • Loading branch information
TCL735 committed Dec 20, 2019
1 parent fcb1b9a commit 38aac00
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,16 @@ resourceListStories.add(
/* eslint-enable */
}

const options: any = {
null: null,
false: false,
'React elements': 'Resource List appears here YAY!',
}
const children = select(
'Children',
options,
'Resource List appears here YAY!'
)
return (
<div className="story--example">
<div className="story--test-buttons">
Expand All @@ -177,7 +187,9 @@ resourceListStories.add(
emptyState={
<div className="mockComponent stretch">EmptyState goes here</div>
}
/>
>
{children}
</ResourceListBody>
</div>
)
},
Expand Down
3 changes: 2 additions & 1 deletion src/Components/ResourceList/List/ResourceListBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export const ResourceListBody = forwardRef<
if (
React.Children.count(children) === 0 ||
children === undefined ||
children === null
children === null ||
children === false
) {
childElement = emptyState
}
Expand Down

0 comments on commit 38aac00

Please # to comment.