1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-16 00:00:06 +02:00
copilot/ui/src/components/list/description.js

44 lines
904 B
JavaScript
Raw Normal View History

2017-01-09 14:13:12 +02:00
const Title = require('./title');
const Styled = require('styled-components');
const React = require('react');
const {
default: styled
} = Styled;
const margin = (props) => props.collapsed ? `
margin-left: auto;
` : '';
const justify = (props) => props.collapsed ? 'flex-end' : 'flex-start';
const xs = (props) => props.collapsed ? 6 : 12;
const StyledTitle = styled(Title)`
font-weight: normal !important;
flex-grow: 2;
`;
const InnerDescription = styled.div`
${margin}
justify-content: ${justify};
`;
const Description = (props) => (
<StyledTitle
collapsed={props.collapsed}
name='list-item-description'
xs={xs(props)}
>
<InnerDescription collapsed={props.collapsed}>
{props.children}
</InnerDescription>
</StyledTitle>
);
Description.propTypes = {
children: React.PropTypes.node,
collapsed: React.PropTypes.bool
};
module.exports = Description;