2017-02-27 17:41:08 +02:00
|
|
|
import { Subscriber } from 'react-broadcast';
|
2017-02-20 18:15:36 +02:00
|
|
|
import styled from 'styled-components';
|
2017-02-27 17:41:08 +02:00
|
|
|
import { Baseline, regular } from '../../shared/composers';
|
2017-02-20 18:15:36 +02:00
|
|
|
import { remcalc, is } from '../../shared/functions';
|
2017-02-27 17:41:08 +02:00
|
|
|
import { colors } from '../../shared/constants';
|
2017-02-20 18:15:36 +02:00
|
|
|
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 Span = styled.span`
|
2017-02-20 18:15:36 +02:00
|
|
|
display: inline-block;
|
2017-01-09 14:13:12 +02:00
|
|
|
flex-direction: column;
|
|
|
|
|
|
|
|
font-weight: normal;
|
|
|
|
font-style: normal;
|
|
|
|
font-stretch: normal;
|
2017-01-12 21:04:52 +02:00
|
|
|
font-size: ${remcalc(14)};
|
2017-01-10 00:14:10 +02:00
|
|
|
|
|
|
|
justify-content: flex-end;
|
2017-02-20 18:15:36 +02:00
|
|
|
|
|
|
|
${is('collapsed')`
|
|
|
|
display: flex;
|
|
|
|
`};
|
2017-02-27 17:41:08 +02:00
|
|
|
|
|
|
|
${is('fromHeader')`
|
|
|
|
color: ${colors.base.white};
|
|
|
|
`};
|
2017-01-10 00:14:10 +02:00
|
|
|
`;
|
|
|
|
|
|
|
|
const StyledTitle = styled(Title)`
|
2017-02-20 18:15:36 +02:00
|
|
|
display: inline-block;
|
|
|
|
padding: 0 ${remcalc(18)};
|
|
|
|
|
2017-02-27 17:41:08 +02:00
|
|
|
${regular};
|
|
|
|
|
2017-02-20 18:15:36 +02:00
|
|
|
${is('collapsed')`
|
|
|
|
display: flex;
|
|
|
|
padding: 0;
|
|
|
|
`};
|
2017-01-09 14:13:12 +02:00
|
|
|
`;
|
|
|
|
|
2017-02-20 18:15:36 +02:00
|
|
|
const Subtitle = ({
|
|
|
|
children,
|
|
|
|
...props
|
2017-02-27 17:41:08 +02:00
|
|
|
}) => {
|
|
|
|
const render = ({
|
|
|
|
fromHeader = false,
|
|
|
|
collapsed = false
|
|
|
|
}) => (
|
|
|
|
<StyledTitle
|
|
|
|
name='list-item-subtitle'
|
|
|
|
fromHeader={fromHeader}
|
|
|
|
collapsed={collapsed}
|
|
|
|
{...props}
|
|
|
|
>
|
|
|
|
<Span fromHeader={fromHeader} collapsed={collapsed}>
|
|
|
|
{children}
|
|
|
|
</Span>
|
|
|
|
</StyledTitle>
|
|
|
|
);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Subscriber channel='list-item'>
|
|
|
|
{render}
|
|
|
|
</Subscriber>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2017-01-09 14:13:12 +02:00
|
|
|
|
|
|
|
Subtitle.propTypes = {
|
2017-01-09 20:58:30 +02:00
|
|
|
children: React.PropTypes.node,
|
2017-02-27 17:41:08 +02:00
|
|
|
collapsed: React.PropTypes.bool,
|
2017-01-09 20:58:30 +02:00
|
|
|
fromHeader: React.PropTypes.bool
|
2017-01-09 14:13:12 +02:00
|
|
|
};
|
|
|
|
|
2017-02-20 18:15:36 +02:00
|
|
|
export default Baseline(
|
2017-02-15 03:19:26 +02:00
|
|
|
Subtitle
|
|
|
|
);
|