2017-01-09 14:13:12 +02:00
|
|
|
const constants = require('../../shared/constants');
|
|
|
|
const fns = require('../../shared/functions');
|
|
|
|
const React = require('react');
|
|
|
|
const Row = require('../row');
|
|
|
|
const Styled = require('styled-components');
|
2017-01-09 20:58:30 +02:00
|
|
|
const transferProps = require('./transfer-props');
|
2017-01-09 14:13:12 +02:00
|
|
|
|
|
|
|
const {
|
|
|
|
boxes,
|
|
|
|
colors
|
|
|
|
} = constants;
|
|
|
|
|
|
|
|
const {
|
|
|
|
remcalc
|
|
|
|
} = fns;
|
|
|
|
|
|
|
|
const {
|
2017-01-10 00:20:54 +02:00
|
|
|
default: styled
|
2017-01-09 14:13:12 +02:00
|
|
|
} = Styled;
|
|
|
|
|
2017-01-09 22:33:32 +02:00
|
|
|
const paper = `
|
|
|
|
0 8px 0 -5px #fafafa,
|
|
|
|
0 8px 1px -4px ${colors.borderSecondary},
|
|
|
|
0 16px 0 -10px #fafafa,
|
2017-01-10 00:14:10 +02:00
|
|
|
0 16px 1px -9px ${colors.borderSecondary};
|
2017-01-09 22:33:32 +02:00
|
|
|
`;
|
|
|
|
|
2017-01-09 20:58:30 +02:00
|
|
|
const height = (props) => props.collapsed
|
|
|
|
? remcalc(48)
|
2017-01-10 00:14:10 +02:00
|
|
|
: 'auto';
|
|
|
|
|
|
|
|
const minHeight = (props) => props.collapsed
|
|
|
|
? 'auto'
|
2017-01-09 20:58:30 +02:00
|
|
|
: remcalc(126);
|
|
|
|
|
2017-01-10 00:14:10 +02:00
|
|
|
// remcalc(126)
|
2017-01-09 22:33:32 +02:00
|
|
|
const shadow = (props) => props.stacked
|
|
|
|
? paper
|
2017-01-10 00:14:10 +02:00
|
|
|
: props.flat
|
|
|
|
? 'none'
|
|
|
|
: props.collapsed && props.headed
|
|
|
|
? boxes.bottomShaddowDarker
|
|
|
|
: boxes.bottomShaddow;
|
2017-01-09 14:13:12 +02:00
|
|
|
|
2017-01-11 16:13:58 +02:00
|
|
|
const marginBottom = (props) => props.stacked
|
|
|
|
? remcalc(16)
|
|
|
|
: remcalc(10);
|
|
|
|
|
2017-01-09 14:13:12 +02:00
|
|
|
const Item = styled(Row)`
|
2017-01-09 20:58:30 +02:00
|
|
|
position: relative;
|
|
|
|
|
2017-01-10 00:14:10 +02:00
|
|
|
height: ${height};
|
|
|
|
min-height: ${minHeight};
|
2017-01-09 20:58:30 +02:00
|
|
|
box-shadow: ${shadow};
|
2017-01-09 14:13:12 +02:00
|
|
|
border: 1px solid ${colors.borderSecondary};
|
|
|
|
background-color: ${colors.brandSecondary};
|
2017-01-11 16:13:58 +02:00
|
|
|
margin-bottom: ${marginBottom};
|
2017-01-09 14:13:12 +02:00
|
|
|
`;
|
|
|
|
|
2017-01-09 20:58:30 +02:00
|
|
|
module.exports = transferProps([
|
|
|
|
'collapsed',
|
|
|
|
'headed'
|
|
|
|
], (props) => (
|
2017-01-09 14:13:12 +02:00
|
|
|
<Item name='list-item' {...props}>
|
|
|
|
{props.children}
|
|
|
|
</Item>
|
|
|
|
));
|