UNPKG

2.92 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6
7var _templateObject = _taggedTemplateLiteral(['\n display: block;\n position: relative;\n text-align: left;\n box-shadow: ', ';\n color: ', ';\n background: ', ';\n border: 1px solid rgba(0, 0, 0, 0.1); \n border-radius: 3px;\n transition: box-shadow 0.3s cubic-bezier(.25,.8,.25,1);\n font-family: ', ';\n\n padding: ', ';\n padding-bottom: ', ';\n\n &:hover {\n box-shadow: ', ';\n }\n\n * { box-sizing: border-box }\n'], ['\n display: block;\n position: relative;\n text-align: left;\n box-shadow: ', ';\n color: ', ';\n background: ', ';\n border: 1px solid rgba(0, 0, 0, 0.1); \n border-radius: 3px;\n transition: box-shadow 0.3s cubic-bezier(.25,.8,.25,1);\n font-family: ', ';\n\n padding: ', ';\n padding-bottom: ', ';\n\n &:hover {\n box-shadow: ', ';\n }\n\n * { box-sizing: border-box }\n']);
8
9var _meta = require('./meta');
10
11var _meta2 = _interopRequireDefault(_meta);
12
13var _styledComponents = require('styled-components');
14
15var _styledComponents2 = _interopRequireDefault(_styledComponents);
16
17var _react = require('react');
18
19var _react2 = _interopRequireDefault(_react);
20
21function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
23function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
24
25function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
26
27var Container = _styledComponents2.default.div(_templateObject, function (props) {
28 return props.border ? null : '0px 5px 10px 0px rgba(0, 0, 0, 0.10)';
29}, function (props) {
30 return props.dark ? props.theme.colors.white : props.theme.colors.black;
31}, function (props) {
32 return props.dark ? props.theme.colors.black : props.theme.colors.white;
33}, function (props) {
34 return props.theme.font.base;
35}, function (props) {
36 return props.theme.spacing.medium;
37}, function (props) {
38 return props.theme.spacing.large;
39}, function (props) {
40 return props.border ? null : '0px 10px 20px 0px rgba(0, 0, 0, 0.20)';
41});
42
43var Card = function Card(_ref) {
44 var children = _ref.children,
45 meta = _ref.meta,
46 other = _objectWithoutProperties(_ref, ['children', 'meta']);
47
48 return _react2.default.createElement(
49 'div',
50 null,
51 _react2.default.createElement(
52 Container,
53 other,
54 children
55 ),
56 _react2.default.createElement(_meta2.default, { meta: meta })
57 );
58};
59
60Card.propTypes = {
61 dark: _react.PropTypes.bool,
62 border: _react.PropTypes.bool,
63 children: _react.PropTypes.node.isRequired,
64 meta: _react.PropTypes.shape({ left: _react.PropTypes.string, right: _react.PropTypes.string })
65};
66
67exports.default = Card;
\No newline at end of file