1
0
mirror of https://github.com/yldio/copilot.git synced 2025-01-10 11:00:13 +02:00
copilot/ui/src/components/list/header.js

52 lines
890 B
JavaScript
Raw Normal View History

2017-01-09 20:58:30 +02:00
const fns = require('../../shared/functions');
const Item = require('./item');
const React = require('react');
const Styled = require('styled-components');
const {
remcalc
} = fns;
const {
default: styled
} = Styled;
const StyledItem = styled(Item)`
position: absolute;
background-color: #3B4AAF;
border: solid ${remcalc(1)} #2D3884;
2017-01-09 20:58:30 +02:00
box-shadow: none;
width: calc(100% + ${remcalc(2)});
margin: 0;
top: ${remcalc(-1)};
left: ${remcalc(-1)};
right: ${remcalc(-1)};
`;
const addFromHeader = (children) => React.Children.map(children, (c) => {
return React.cloneElement(c, {
...c.props,
fromHeader: true
});
});
const Header = (props) => (
<StyledItem
collapsed
headed
name='list-item-header'
>
{addFromHeader(props.children)}
</StyledItem>
);
Header.propTypes = {
children: React.PropTypes.node
};
module.exports = Header;