Skip to content

Commit

Permalink
Fixed a bug where the size prop does not work as expected with 'extra…
Browse files Browse the repository at this point in the history
…-small', 'small', 'medium', 'large'
  • Loading branch information
cheton committed Mar 22, 2018
1 parent e8a193d commit 29e11ee
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dist/react-modal.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/react-modal.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 15 additions & 2 deletions docs/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -20491,13 +20491,26 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de

function _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; }

var mapSizeToStyle = function mapSizeToStyle(size) {
return {
'xs': _index2.default.xs,
'sm': _index2.default.sm,
'md': _index2.default.md,
'lg': _index2.default.lg,
'extra-small': _index2.default.xs,
'small': _index2.default.sm,
'medium': _index2.default.md,
'large': _index2.default.lg
}[size];
};

var ModalContent = function ModalContent(_ref) {
var className = _ref.className,
size = _ref.size,
props = _objectWithoutProperties(_ref, ['className', 'size']);

return _react2.default.createElement('div', _extends({}, props, {
className: (0, _classnames2.default)(className, _index2.default.modalContent, _index2.default[size])
className: (0, _classnames2.default)(className, _index2.default.modalContent, mapSizeToStyle(size))
}));
};

Expand Down Expand Up @@ -21585,4 +21598,4 @@ exports.default = function (Component) {
/***/ })

/******/ });
//# sourceMappingURL=bundle.js.map?6a3b71b90cc56bdeeff3
//# sourceMappingURL=bundle.js.map?236fcad81b67ac2c0fcc
2 changes: 1 addition & 1 deletion docs/bundle.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@
</nav>
<div id="container"></div>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js"></script>
<script type="text/javascript" src="bundle.js?6a3b71b90cc56bdeeff3"></script></body>
<script type="text/javascript" src="bundle.js?236fcad81b67ac2c0fcc"></script></body>
</html>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@trendmicro/react-modal",
"version": "2.0.4",
"version": "2.0.5",
"description": "React Modal component",
"main": "lib/index.js",
"files": [
Expand Down
13 changes: 12 additions & 1 deletion src/ModalContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,24 @@ import PropTypes from 'prop-types';
import React from 'react';
import styles from './index.styl';

const mapSizeToStyle = (size) => ({
'xs': styles.xs,
'sm': styles.sm,
'md': styles.md,
'lg': styles.lg,
'extra-small': styles.xs,
'small': styles.sm,
'medium': styles.md,
'large': styles.lg
}[size]);

const ModalContent = ({ className, size, ...props }) => (
<div
{...props}
className={cx(
className,
styles.modalContent,
styles[size]
mapSizeToStyle(size)
)}
/>
);
Expand Down

0 comments on commit 29e11ee

Please sign in to comment.