Skip to content

Commit

Permalink
[added] Ability to specify style for the modal contents
Browse files Browse the repository at this point in the history
This makes it so you can pass a style prop to the ReactModal component
which will be added to the contents of the modal.  This is really
nice for instances where adding a className isn't appropriate such
as when position needs to be set dynamically.
  • Loading branch information
claydiffrient committed Apr 9, 2015
1 parent 0b2028e commit f5fe537
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/components/ModalPortal.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ var ModalPortal = module.exports = React.createClass({
},
div({
ref: "content",
style: this.props.style,
className: cx(this.buildClassName('content'), this.props.className),
tabIndex: "-1",
onClick: stopPropagation,
Expand Down
5 changes: 5 additions & 0 deletions specs/Modal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ describe('Modal', function () {
unmountModal();
});

it('supports adding style to the modal contents', function () {
var modal = renderModal({isOpen: true, style: {width: '20px'}});
equal(modal.portal.refs.content.getDOMNode().style.width, '20px');
});

it('adds --after-open for animations', function() {
var modal = renderModal({isOpen: true});
var overlay = document.querySelector('.ReactModal__Overlay');
Expand Down

0 comments on commit f5fe537

Please sign in to comment.