Skip to content

Commit 65717e2

Browse files
Merge pull request #82 from tutorcruncher/modal-parent
Rest of comments
2 parents bb5ee7d + cd26fcd commit 65717e2

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/components/appointments/AptModal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class AptModal extends Component {
174174
if (!apt) {
175175
return (
176176
<Modal history={this.props.history}
177-
parent_el={this.props.config.modal_parent}
177+
config={this.props.config}
178178
title={this.props.config.get_text('appointment_not_found')}>
179179
<p>{this.props.config.get_text('appointment_not_found_id', {apt_id: this.props.id})}</p>
180180
</Modal>

src/components/shared/Modal.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class Modal extends Component {
4545

4646
render () {
4747
const flex = this.props.flex !== undefined ? Boolean(this.props.flex) : true
48-
const el = (
48+
const modal_content = (
4949
<div className={'tcs-modal-mask' + (this.state.show ? ' tcs-show' : '')} onClick={this.close}>
5050
<div className="tcs-modal" onClick={e => e.stopPropagation()}>
5151
<div className="tcs-header">
@@ -63,10 +63,11 @@ class Modal extends Component {
6363
</div>
6464
</div>
6565
)
66-
if (this.props.config.parent_el) {
67-
return ReactDOM.createPortal(el, document.getElementById(this.props.config.parent_el))
66+
const container_id = this.props.config.modal_container
67+
if (container_id) {
68+
return ReactDOM.createPortal(modal_content, document.getElementById(container_id))
6869
} else {
69-
return el
70+
return modal_content
7071
}
7172
}
7273
}

0 commit comments

Comments
 (0)