joyent-portal/ui/src/components/table-simple-table/table-body.js

43 lines
658 B
JavaScript
Raw Normal View History

2017-01-19 16:59:59 +02:00
const composers = require('../../shared/composers');
const React = require('react');
const Styled = require('styled-components');
const {
2017-02-20 16:51:54 +02:00
default: styled
2017-01-19 16:59:59 +02:00
} = Styled;
const {
2017-02-15 03:19:26 +02:00
clearfix,
Baseline
2017-01-19 16:59:59 +02:00
} = composers;
const StyledTableBody = styled.article`
box-shadow: 0 2px 0 0 rgba(0, 0, 0, 0.05);
2017-02-15 03:19:26 +02:00
2017-01-19 16:59:59 +02:00
${clearfix}
`;
const TableBody = ({
children
}) => {
const itemCount = children.length;
2017-02-15 03:19:26 +02:00
if (itemCount <= 1) {
return null;
}
2017-01-19 16:59:59 +02:00
return (
<StyledTableBody itemCount={itemCount}>
{children}
</StyledTableBody>
);
};
TableBody.propTypes = {
children: React.PropTypes.node
};
2017-02-15 03:19:26 +02:00
module.exports = Baseline(
StyledTableBody
);