joyent-portal/ui/src/components/list/subtitle.js

45 lines
837 B
JavaScript
Raw Normal View History

2017-01-09 20:58:30 +02:00
const constants = require('../../shared/constants');
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-09 14:13:12 +02:00
const {
default: styled
} = Styled;
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;
justify-content: flex-start;
font-weight: normal;
font-style: normal;
font-stretch: normal;
font-size: 14px;
2017-01-09 20:58:30 +02:00
color: ${color};
2017-01-09 14:13:12 +02:00
`;
const Subtitle = (props) => (
<Title 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>
</Title>
);
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;