1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-14 07:10:05 +02:00
copilot/ui/src/components/mini-metric/view.js

53 lines
949 B
JavaScript
Raw Normal View History

const constants = require('../../shared/constants');
2017-01-10 21:12:50 +02:00
const fns = require('../../shared/functions');
const React = require('react');
const Styled = require('styled-components');
const {
colors
} = constants;
2017-01-10 21:12:50 +02:00
const {
remcalc
} = fns;
const {
default: styled
} = Styled;
2017-01-11 16:14:26 +02:00
const border = (props) => !props.borderless
? `solid ${remcalc(1)} ${colors.borderSecondary}`
: 'none';
2017-01-10 21:12:50 +02:00
const Container = styled.div`
position: relative;
height: 100%;
width: 100%;
background-color: ${colors.miniBackground};
2017-01-11 16:14:26 +02:00
border: ${border};
2017-01-10 21:12:50 +02:00
`;
const Shadow = styled.div`
2017-01-11 16:14:26 +02:00
z-index: 1;
2017-01-10 21:12:50 +02:00
position: absolute;
height: 100%;
width: ${remcalc(9)};
left: 0;
top: 0;
background-image:
linear-gradient(to right, rgba(0, 0, 0, 0.1), rgba(216, 216, 216, 0));
`;
2017-01-10 21:12:50 +02:00
const View = (props) => (
<Container {...props}>
<Shadow />
{props.children}
</Container>
);
View.propTypes = {
children: React.PropTypes.node
};
module.exports = View;