pass theme from layout to children

old
Benjamin Schnelle 2016-07-28 22:12:55 -06:00
parent 0c53de91a3
commit 491a85c3a0
2 changed files with 4 additions and 2 deletions

View File

@ -5,7 +5,7 @@ import { LAYOUT } from '../identifiers.js';
const Layout = ({ className, children, theme }) => (
<div data-react-toolbox='layout' className={classnames(theme.layout, className)}>
{children}
{React.Children.map(children, (child) => React.cloneElement(child, { theme }))}
</div>
);

View File

@ -26,7 +26,9 @@ var Layout = function Layout(_ref) {
return _react2.default.createElement(
'div',
{ 'data-react-toolbox': 'layout', className: (0, _classnames2.default)(theme.layout, className) },
children
_react2.default.Children.map(children, function (child) {
return _react2.default.cloneElement(child, { theme: theme });
})
);
};