1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-14 15:20:06 +02:00
copilot/ui/src/components/list/meta.js

41 lines
743 B
JavaScript
Raw Normal View History

2017-01-09 14:13:12 +02:00
const Column = require('../column');
const React = require('react');
const Row = require('../row');
2017-01-09 20:58:30 +02:00
const Styled = require('styled-components');
const transferProps = require('./transfer-props');
const View = require('./view');
2017-01-09 14:13:12 +02:00
const {
default: styled
} = Styled;
const xs = (props) => props.collapsed ? 12 : 6;
const InnerRow = styled(Row)`
height: 100%;
`;
2017-01-09 20:58:30 +02:00
module.exports = transferProps([
'collapsed',
'headed',
'fromHeader'
], (props) => {
const meta = (
<Column
name='list-item-meta'
xs={xs(props)}
{...props}
>
<InnerRow>
{props.children}
</InnerRow>
</Column>
);
return !props.fromHeader ? meta : (
<View collapsed fromHeader>
{meta}
</View>
);
});