Skip to content

Commit

Permalink
fix(Modal): add/remove dimmer classes properly
Browse files Browse the repository at this point in the history
  • Loading branch information
levithomason committed Sep 30, 2017
1 parent 00d22b7 commit 296d8b6
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions src/modules/Modal/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,24 +229,20 @@ class Modal extends Component {
handleRef = c => (this.ref = c)

setPositionAndClassNames = () => {
const { dimmer } = this.props
const mountNode = this.getMountNode()

if (this.ref) {
const { dimmer } = this.props
const mountNode = this.getMountNode()
const { height } = this.ref.getBoundingClientRect()

if (dimmer) {
mountNode.classList.add('dimmable')
mountNode.classList.add('dimmed')
if (dimmer) {
mountNode.classList.add('dimmable')
mountNode.classList.add('dimmed')

if (dimmer === 'blurring') {
mountNode.classList.add('blurring')
}
} else {
mountNode.classList.add('dimmable')
mountNode.classList.add('dimmed')
if (dimmer === 'blurring') {
mountNode.classList.add('blurring')
}
}

if (this.ref) {
const { height } = this.ref.getBoundingClientRect()

const marginTop = -Math.round(height / 2)
const scrolling = height >= window.innerHeight
Expand Down

0 comments on commit 296d8b6

Please sign in to comment.