2017-02-20 18:15:36 +02:00
|
|
|
import { Baseline } from '../../shared/composers';
|
|
|
|
import { remcalc, is } from '../../shared/functions';
|
|
|
|
import styled from 'styled-components';
|
|
|
|
import Title from './title';
|
|
|
|
import React from 'react';
|
2017-01-11 16:13:58 +02:00
|
|
|
|
|
|
|
const xs = (props) => props.collapsed
|
|
|
|
? 6
|
|
|
|
: 12;
|
|
|
|
|
2017-01-09 14:13:12 +02:00
|
|
|
const StyledTitle = styled(Title)`
|
2017-02-20 18:15:36 +02:00
|
|
|
${is('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-11 16:13:58 +02:00
|
|
|
|
2017-02-15 15:59:49 +02:00
|
|
|
font-weight: normal;
|
2017-01-09 14:13:12 +02:00
|
|
|
flex-grow: 2;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const InnerDescription = styled.div`
|
2017-02-20 18:15:36 +02:00
|
|
|
justify-content: flex-start;
|
|
|
|
|
|
|
|
${is('collapsed')`
|
|
|
|
margin-left: auto;
|
|
|
|
justify-content: flex-end;
|
|
|
|
`};
|
2017-01-09 14:13:12 +02:00
|
|
|
`;
|
|
|
|
|
2017-02-20 18:15:36 +02:00
|
|
|
const Description = ({
|
|
|
|
children,
|
|
|
|
collapsed,
|
|
|
|
...props
|
|
|
|
}) => (
|
2017-01-09 14:13:12 +02:00
|
|
|
<StyledTitle
|
2017-02-20 18:15:36 +02:00
|
|
|
{...props}
|
2017-01-09 14:13:12 +02:00
|
|
|
name='list-item-description'
|
|
|
|
xs={xs(props)}
|
|
|
|
>
|
2017-02-20 18:15:36 +02:00
|
|
|
<InnerDescription collapsed={collapsed}>
|
|
|
|
{children}
|
2017-01-09 14:13:12 +02:00
|
|
|
</InnerDescription>
|
|
|
|
</StyledTitle>
|
|
|
|
);
|
|
|
|
|
|
|
|
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
|
|
|
|
);
|