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-02-27 17:41:08 +02:00
|
|
|
import { remcalc, is, isNot } from '../../shared/functions';
|
2017-02-20 18:15:36 +02:00
|
|
|
import styled from 'styled-components';
|
|
|
|
import Title from './title';
|
|
|
|
import React from 'react';
|
2017-01-11 16:13:58 +02:00
|
|
|
|
2017-01-09 14:13:12 +02:00
|
|
|
const StyledTitle = styled(Title)`
|
2017-02-27 17:41:08 +02:00
|
|
|
font-weight: normal;
|
|
|
|
flex-grow: 2;
|
|
|
|
|
|
|
|
${isNot('collapsed')`
|
2017-01-11 16:13:58 +02:00
|
|
|
position: absolute;
|
|
|
|
bottom: 0;
|
|
|
|
padding-bottom: ${remcalc(12)};
|
|
|
|
padding-top: 0;
|
2017-02-20 18:15:36 +02:00
|
|
|
`};
|
2017-01-09 14:13:12 +02:00
|
|
|
`;
|
|
|
|
|
|
|
|
const InnerDescription = styled.div`
|
2017-02-20 18:15:36 +02:00
|
|
|
justify-content: flex-start;
|
|
|
|
|
|
|
|
${is('collapsed')`
|
|
|
|
justify-content: flex-end;
|
2017-02-27 17:41:08 +02:00
|
|
|
margin-left: auto;
|
2017-02-20 18:15:36 +02:00
|
|
|
`};
|
2017-01-09 14:13:12 +02:00
|
|
|
`;
|
|
|
|
|
2017-02-20 18:15:36 +02:00
|
|
|
const Description = ({
|
|
|
|
children,
|
|
|
|
...props
|
2017-02-27 17:41:08 +02:00
|
|
|
}) => {
|
|
|
|
const render = ({
|
|
|
|
collapsed = false
|
|
|
|
}) => (
|
|
|
|
<StyledTitle
|
|
|
|
collapsed={collapsed}
|
|
|
|
name='list-item-description'
|
|
|
|
xs={collapsed ? 6 : 12}
|
|
|
|
>
|
|
|
|
<InnerDescription collapsed={collapsed}>
|
|
|
|
{children}
|
|
|
|
</InnerDescription>
|
|
|
|
</StyledTitle>
|
|
|
|
);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Subscriber channel='list-item'>
|
|
|
|
{render}
|
|
|
|
</Subscriber>
|
|
|
|
);
|
|
|
|
};
|
2017-01-09 14:13:12 +02:00
|
|
|
|
|
|
|
Description.propTypes = {
|
|
|
|
children: React.PropTypes.node,
|
|
|
|
collapsed: React.PropTypes.bool
|
|
|
|
};
|
|
|
|
|
2017-02-20 18:15:36 +02:00
|
|
|
export default Baseline(
|
2017-02-15 03:19:26 +02:00
|
|
|
Description
|
|
|
|
);
|