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

53 lines
953 B
JavaScript
Raw Normal View History

import styled from 'styled-components';
import { Baseline } from '../../shared/composers';
import { remcalc, is } from '../../shared/functions';
import Title from './title';
import React from 'react';
2017-01-09 14:13:12 +02:00
const Span = styled.span`
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;
${is('collapsed')`
display: flex;
`};
2017-01-10 00:14:10 +02:00
`;
const StyledTitle = styled(Title)`
display: inline-block;
padding: 0 ${remcalc(18)};
${is('collapsed')`
display: flex;
padding: 0;
`};
2017-01-09 14:13:12 +02:00
`;
const Subtitle = ({
children,
fromHeader,
...props
}) => (
2017-01-10 00:14:10 +02:00
<StyledTitle name='list-item-subtitle' {...props}>
<Span fromHeader={fromHeader}>
{children}
2017-01-09 14:13:12 +02:00
</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
};
export default Baseline(
2017-02-15 03:19:26 +02:00
Subtitle
);