2017-02-20 18:15:36 +02:00
|
|
|
import styled from 'styled-components';
|
|
|
|
import transferProps from '../../shared/transfer-props';
|
|
|
|
import { Baseline } from '../../shared/composers';
|
|
|
|
import { is } from '../../shared/functions';
|
|
|
|
import Column from '../column';
|
|
|
|
import Row from '../row';
|
|
|
|
import View from './view';
|
|
|
|
import React from 'react';
|
2017-02-15 03:19:26 +02:00
|
|
|
|
2017-02-03 17:21:57 +02:00
|
|
|
const md = (props) => props.collapsed
|
2017-01-11 16:13:58 +02:00
|
|
|
? 12
|
|
|
|
: 6;
|
|
|
|
|
2017-01-09 14:13:12 +02:00
|
|
|
const InnerRow = styled(Row)`
|
2017-02-20 18:15:36 +02:00
|
|
|
display: block;
|
2017-01-09 14:13:12 +02:00
|
|
|
height: 100%;
|
2017-02-20 18:15:36 +02:00
|
|
|
|
|
|
|
${is('collapsed')`
|
|
|
|
display: flex;
|
|
|
|
`};
|
2017-01-09 14:13:12 +02:00
|
|
|
`;
|
|
|
|
|
2017-02-15 03:19:26 +02:00
|
|
|
const Meta = transferProps([
|
2017-01-09 20:58:30 +02:00
|
|
|
'collapsed',
|
|
|
|
'headed',
|
|
|
|
'fromHeader'
|
2017-02-20 18:15:36 +02:00
|
|
|
], ({
|
|
|
|
children,
|
|
|
|
collapsed,
|
|
|
|
...props
|
|
|
|
}) => {
|
2017-01-09 20:58:30 +02:00
|
|
|
const meta = (
|
|
|
|
<Column
|
2017-02-03 17:21:57 +02:00
|
|
|
md={md(props)}
|
2017-01-09 20:58:30 +02:00
|
|
|
name='list-item-meta'
|
2017-02-03 17:21:57 +02:00
|
|
|
xs={12}
|
2017-01-09 20:58:30 +02:00
|
|
|
{...props}
|
|
|
|
>
|
2017-02-20 18:15:36 +02:00
|
|
|
<InnerRow collapsed={collapsed}>
|
|
|
|
{children}
|
2017-01-09 20:58:30 +02:00
|
|
|
</InnerRow>
|
|
|
|
</Column>
|
|
|
|
);
|
|
|
|
|
|
|
|
return !props.fromHeader ? meta : (
|
|
|
|
<View collapsed fromHeader>
|
|
|
|
{meta}
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
});
|
2017-02-15 03:19:26 +02:00
|
|
|
|
2017-02-20 18:15:36 +02:00
|
|
|
export default Baseline(
|
2017-02-15 03:19:26 +02:00
|
|
|
Meta
|
|
|
|
);
|