mirror of
https://github.com/yldio/copilot.git
synced 2024-11-16 00:00:06 +02:00
44 lines
904 B
JavaScript
44 lines
904 B
JavaScript
|
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;
|