Skip to content

Commit

Permalink
feat(Card): render prop
Browse files Browse the repository at this point in the history
  • Loading branch information
zouxuoz committed Sep 4, 2018
1 parent 6bdf6c8 commit 4159c8e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/atoms/Card/CardPlate.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ type CardPlateProps = {|
const CardPlate = ({ children, paddingOuter, padding, ...rest }: CardPlateProps) => (
<Paper { ...rest } padding={ paddingOuter }>
{
React.Children.map(children, child =>
React.cloneElement(child, { padding: child.props.padding || padding }),
)

typeof children === 'function'
?
children(rest)
:
React.Children.map(children, child =>
React.cloneElement(child, { padding: child.props.padding || padding }),
)
}
</Paper>
);
Expand Down

0 comments on commit 4159c8e

Please sign in to comment.