UNPKG

3.52 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\n ', '\n\n &:hover {\n box-shadow: ', ';\n }\n\n p:first-child, h1:first-child, h2:first-child, h3:first-child {\n margin-top: -0.05em;\n }\n\n p:last-child, h1:last-child, h2:last-child, h3:last-child {\n margin-bottom: -0.05em;\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\n ', '\n\n &:hover {\n box-shadow: ', ';\n }\n\n p:first-child, h1:first-child, h2:first-child, h3:first-child {\n margin-top: -0.05em;\n }\n\n p:last-child, h1:last-child, h2:last-child, h3:last-child {\n margin-bottom: -0.05em;\n }\n\n * { box-sizing: border-box }\n']),
8 _templateObject2 = _taggedTemplateLiteral(['\n padding: ', ';\n '], ['\n padding: ', ';\n ']);
9
10var _meta = require('./meta');
11
12var _meta2 = _interopRequireDefault(_meta);
13
14var _media = require('../library/media');
15
16var _media2 = _interopRequireDefault(_media);
17
18var _styledComponents = require('styled-components');
19
20var _styledComponents2 = _interopRequireDefault(_styledComponents);
21
22var _react = require('react');
23
24var _react2 = _interopRequireDefault(_react);
25
26function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
28function _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; }
29
30function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
31
32var Container = _styledComponents2.default.div(_templateObject, function (props) {
33 return props.border ? null : '0px 5px 10px 0px rgba(0, 0, 0, 0.10)';
34}, function (props) {
35 return props.dark ? props.theme.colors.white : props.theme.colors.black;
36}, function (props) {
37 return props.dark ? props.theme.colors.black : props.theme.colors.white;
38}, function (props) {
39 return props.theme.font.base;
40}, function (props) {
41 return props.theme.spacing.medium;
42}, _media2.default.wide(_templateObject2, function (props) {
43 return props.theme.spacing.large;
44}), function (props) {
45 return props.border ? null : '0px 10px 20px 0px rgba(0, 0, 0, 0.20)';
46});
47
48var Card = function Card(_ref) {
49 var children = _ref.children,
50 meta = _ref.meta,
51 other = _objectWithoutProperties(_ref, ['children', 'meta']);
52
53 return _react2.default.createElement(
54 'div',
55 null,
56 _react2.default.createElement(
57 Container,
58 other,
59 children
60 ),
61 _react2.default.createElement(_meta2.default, { meta: meta })
62 );
63};
64
65Card.propTypes = {
66 dark: _react.PropTypes.bool,
67 border: _react.PropTypes.bool,
68 children: _react.PropTypes.node.isRequired,
69 meta: _react.PropTypes.shape({ left: _react.PropTypes.string, right: _react.PropTypes.string })
70};
71
72exports.default = Card;
\No newline at end of file