@roo-ui/components
Version:
74 lines (55 loc) • 2.62 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _templateObject = _taggedTemplateLiteral(['\n text-align: center;\n padding: 0 ', ';\n width: ', ';\n\n ', ';\n\n'], ['\n text-align: center;\n padding: 0 ', ';\n width: ', ';\n\n ', ';\n\n']);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _styledSystem = require('styled-system');
var _styledComponents = require('styled-components');
var _ = require('../../../');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var Wrapper = _.Box.extend(_templateObject, (0, _styledSystem.themeGet)('space.4'), function (props) {
return 100 / props.monthsToDisplay + '%';
}, function (props) {
return props.stacked && (0, _styledComponents.css)(['width:100%;margin-top:', ';&:first-of-type{margin-top:0;}'], (0, _styledSystem.themeGet)('space.8'));
});
var CalendarMonth = function CalendarMonth(_ref) {
var monthsToDisplay = _ref.monthsToDisplay,
month = _ref.month,
year = _ref.year,
stacked = _ref.stacked,
children = _ref.children;
return _react2.default.createElement(
Wrapper,
{ monthsToDisplay: monthsToDisplay, stacked: stacked },
_react2.default.createElement(
_.Text,
{ textStyle: 'caps' },
month,
' ',
year
),
children
);
};
Wrapper.defaultProps = _extends({}, _.Box.defaultProps, {
blacklist: [].concat(_toConsumableArray(Object.keys(_.Box.propTypes)), ['monthsToDisplay', 'stacked'])
});
CalendarMonth.defaultProps = {
monthsToDisplay: 1,
stacked: false
};
CalendarMonth.propTypes = {
monthsToDisplay: _propTypes2.default.number,
month: _propTypes2.default.string.isRequired,
year: _propTypes2.default.number.isRequired,
children: _propTypes2.default.node.isRequired,
stacked: _propTypes2.default.bool
};
exports.default = CalendarMonth;
;