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

55 lines
946 B
JavaScript
Raw Normal View History

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
? 12
: 6;
2017-01-09 14:13:12 +02:00
const InnerRow = styled(Row)`
display: block;
2017-01-09 14:13:12 +02:00
height: 100%;
${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'
], ({
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}
>
<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
export default Baseline(
2017-02-15 03:19:26 +02:00
Meta
);