Skip to content

Commit

Permalink
React Modal v3 (#4)
Browse files Browse the repository at this point in the history
* Deprecate "disableOverlay" prop and replace it with "disableOverlayClick"

* Integrate Webpack 4, Babel 7 and Styleguidist

* Bump to 3.0.0

* Update the code to use the `React.createRef()` API introduced in React 16.3

* Remove unused parameter

* Update README.md

* Update license year to 2019
  • Loading branch information
cheton authored Jan 1, 2019
1 parent 5d45dbc commit dd162d2
Show file tree
Hide file tree
Showing 28 changed files with 747 additions and 28,184 deletions.
10 changes: 0 additions & 10 deletions .babelrc

This file was deleted.

8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class ModalWrapper extends PureComponent {
static propTypes = {
...Modal.propTypes
};

static defaultProps = {
...Modal.defaultProps
};
Expand All @@ -118,12 +119,15 @@ class ModalWrapper extends PureComponent {
}
}
}

componentDidMount() {
this.changeBodyStyle();
}

componentWillUnmount() {
this.restoreBodyStyle();
}

changeBodyStyle() {
if (bodyStyle) {
return;
Expand All @@ -135,13 +139,15 @@ class ModalWrapper extends PureComponent {
};
body.style.overflowY = 'hidden';
}

restoreBodyStyle() {
if (bodyStyle) {
const body = document.querySelector('body');
body.style.overflowY = bodyStyle.overflowY;
bodyStyle = null;
}
}

render() {
const { onClose, ...props } = this.props;

Expand Down Expand Up @@ -177,7 +183,7 @@ onClose | Function | | A callback fired on clicking the overlay or the close but
show | Boolean | true | Whether the modal is visible.
showCloseButton | Boolean | true | Whether the close button (x) is visible.
showOverlay | Boolean | true | Display an overlay in the background. Defaults to `true`.
disableOverlay | Boolean | false | Don't close the modal on clicking the overlay. Defaults to `false`.
disableOverlayClick | Boolean | false | Don't close the modal on clicking the overlay. Defaults to `false`.
overlayClassName | String | | className to assign to modal overlay.
overlayStyle | Object | | style to assign to modal overlay.
size | String | '' | One of: 'xs', 'sm', 'md', 'lg', 'extra-small', 'small', 'medium', 'large', or an empty string. Defaults to empty string that will automatically resize to fit contents.
Expand Down
7 changes: 7 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
extends: '@trendmicro/babel-config',
presets: [
'@babel/preset-env',
'@babel/preset-react'
]
};
3 changes: 2 additions & 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.css.map

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.

5 changes: 0 additions & 5 deletions docs/4be67fb1948530c73d9a55b1736d6d7f.svg

This file was deleted.

1 change: 1 addition & 0 deletions docs/build/1.690ec258.js

Large diffs are not rendered by default.

Loading

0 comments on commit dd162d2

Please sign in to comment.