2017-02-20 18:15:36 +02:00
|
|
|
import styled from 'styled-components';
|
2017-02-27 17:41:08 +02:00
|
|
|
import { Subscriber } from 'react-broadcast';
|
2017-02-20 18:15:36 +02:00
|
|
|
import { Baseline } from '../../shared/composers';
|
2017-03-22 18:50:26 +02:00
|
|
|
import { is } from '../../shared/functions';
|
2017-02-20 18:15:36 +02:00
|
|
|
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-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
|
|
|
|
2017-03-22 14:15:09 +02:00
|
|
|
position: absolute;
|
|
|
|
top: 50%;
|
|
|
|
transform: translateY(-50%);
|
|
|
|
|
2017-02-20 18:15:36 +02:00
|
|
|
${is('collapsed')`
|
|
|
|
display: flex;
|
|
|
|
`};
|
2017-01-09 14:13:12 +02:00
|
|
|
`;
|
|
|
|
|
2017-02-27 17:41:08 +02:00
|
|
|
const Meta = ({
|
2017-02-20 18:15:36 +02:00
|
|
|
children,
|
|
|
|
...props
|
|
|
|
}) => {
|
2017-02-27 17:41:08 +02:00
|
|
|
const render = ({
|
|
|
|
collapsed = false,
|
|
|
|
fromHeader = false,
|
|
|
|
headed = false
|
|
|
|
}) => {
|
|
|
|
const meta = (
|
|
|
|
<Column
|
|
|
|
name='list-item-meta'
|
|
|
|
xs={collapsed ? 12 : 6}
|
|
|
|
collapsed={collapsed}
|
|
|
|
fromHeader={fromHeader}
|
|
|
|
headed={headed}
|
|
|
|
{...props}
|
|
|
|
>
|
|
|
|
<InnerRow collapsed={collapsed}>
|
|
|
|
{children}
|
|
|
|
</InnerRow>
|
|
|
|
</Column>
|
|
|
|
);
|
2017-01-09 20:58:30 +02:00
|
|
|
|
2017-02-27 17:41:08 +02:00
|
|
|
return !fromHeader ? meta : (
|
|
|
|
<View collapsed fromHeader>
|
|
|
|
{meta}
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Subscriber channel='list-item'>
|
|
|
|
{render}
|
|
|
|
</Subscriber>
|
2017-01-09 20:58:30 +02:00
|
|
|
);
|
2017-02-27 17:41:08 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
Meta.propTypes = {
|
|
|
|
children: React.PropTypes.node,
|
|
|
|
collapsed: React.PropTypes.bool,
|
|
|
|
fromHeader: React.PropTypes.bool,
|
|
|
|
headed: React.PropTypes.bool
|
|
|
|
};
|
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
|
|
|
|
);
|