2017-01-09 20:58:30 +02:00
|
|
|
const constants = require('../../shared/constants');
|
2017-01-10 00:14:10 +02:00
|
|
|
const fns = require('../../shared/functions');
|
2017-01-09 14:13:12 +02:00
|
|
|
const Title = require('./title');
|
|
|
|
const React = require('react');
|
|
|
|
const Styled = require('styled-components');
|
|
|
|
|
2017-01-09 20:58:30 +02:00
|
|
|
const {
|
|
|
|
colors
|
|
|
|
} = constants;
|
|
|
|
|
2017-01-10 00:14:10 +02:00
|
|
|
const {
|
|
|
|
remcalc
|
|
|
|
} = fns;
|
|
|
|
|
2017-01-09 14:13:12 +02:00
|
|
|
const {
|
|
|
|
default: styled
|
|
|
|
} = Styled;
|
|
|
|
|
2017-01-10 00:14:10 +02:00
|
|
|
const padding = (props) => !props.collapsed
|
|
|
|
? `0 ${remcalc(18)}`
|
2017-01-10 00:20:54 +02:00
|
|
|
: 0;
|
2017-01-10 00:14:10 +02:00
|
|
|
|
2017-01-09 20:58:30 +02:00
|
|
|
const color = (props) => props.fromHeader
|
|
|
|
? colors.brandPrimaryColor
|
|
|
|
: '#646464';
|
|
|
|
|
2017-01-09 14:13:12 +02:00
|
|
|
const Span = styled.span`
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
|
|
font-weight: normal;
|
|
|
|
font-style: normal;
|
|
|
|
font-stretch: normal;
|
|
|
|
font-size: 14px;
|
2017-01-09 20:58:30 +02:00
|
|
|
color: ${color};
|
2017-01-10 00:14:10 +02:00
|
|
|
|
|
|
|
justify-content: flex-end;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const StyledTitle = styled(Title)`
|
|
|
|
padding: ${padding};
|
2017-01-09 14:13:12 +02:00
|
|
|
`;
|
|
|
|
|
|
|
|
const Subtitle = (props) => (
|
2017-01-10 00:14:10 +02:00
|
|
|
<StyledTitle name='list-item-subtitle' {...props}>
|
2017-01-09 20:58:30 +02:00
|
|
|
<Span
|
|
|
|
fromHeader={props.fromHeader}
|
|
|
|
>
|
2017-01-09 14:13:12 +02:00
|
|
|
{props.children}
|
|
|
|
</Span>
|
2017-01-10 00:14:10 +02:00
|
|
|
</StyledTitle>
|
2017-01-09 14:13:12 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
Subtitle.propTypes = {
|
2017-01-09 20:58:30 +02:00
|
|
|
children: React.PropTypes.node,
|
|
|
|
fromHeader: React.PropTypes.bool
|
2017-01-09 14:13:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = Subtitle;
|