File tree Expand file tree Collapse file tree 4 files changed +28
-12
lines changed
Expand file tree Collapse file tree 4 files changed +28
-12
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,6 @@ const TRANSITION_TIME = 500
99class ConModal extends Component {
1010 constructor ( props ) {
1111 super ( props )
12- this . con_id = parseInt ( this . props . id , 10 )
1312 this . state = {
1413 show_enquiry : false ,
1514 transition_class : ''
@@ -20,7 +19,7 @@ class ConModal extends Component {
2019
2120 get_contractor ( ) {
2221 for ( let contractor of this . props . contractors ) {
23- if ( contractor . id === this . con_id ) {
22+ if ( contractor . link === this . props . con_link ) {
2423 return { contractor, contractor_extra : this . props . get_contractor_details ( contractor ) }
2524 }
2625 }
Original file line number Diff line number Diff line change @@ -84,8 +84,8 @@ class Contractors extends Component {
8484 subject_change = { this . subject_change }
8585 root = { this . props . root } />
8686
87- < Route path = { this . props . root . url ( ':id ([0-9]+):_extra ' ) } render = { props => (
88- < ConModal id = { props . match . params . id }
87+ < Route path = { this . props . root . url ( ':con ([0-9]+-.+) ' ) } render = { props => (
88+ < ConModal con_link = { props . match . params . con }
8989 contractors = { this . state . contractors }
9090 got_contractors = { this . state . got_contractors }
9191 get_contractor_details = { this . get_contractor_details }
Original file line number Diff line number Diff line change @@ -4,13 +4,15 @@ import EnquiryModal from './EnquiryModal'
44
55const EnquiryButton = ( { root, config} ) => (
66 < div className = "tcs-app" >
7- < Link to = { root . url ( 'enquiry' ) } className = "tcs-enquiry-button" >
8- { root . get_text ( 'enquiry_button' ) }
9- </ Link >
7+ < div class = "tcs-enquiry-modal" >
8+ < Link to = { root . url ( 'enquiry' ) } className = "tcs-enquiry-button" >
9+ { root . get_text ( 'enquiry_button' ) }
10+ </ Link >
1011
11- < Route path = { root . url ( 'enquiry' ) } render = { props => (
12- < EnquiryModal root = { root } config = { config } history = { props . history } />
13- ) } />
12+ < Route path = { root . url ( 'enquiry' ) } render = { props => (
13+ < EnquiryModal root = { root } config = { config } history = { props . history } />
14+ ) } />
15+ </ div >
1416 </ div >
1517)
1618
Original file line number Diff line number Diff line change @@ -6,18 +6,33 @@ class Modal extends Component {
66 constructor ( props ) {
77 super ( props )
88 this . state = {
9- show : true
9+ show : true ,
1010 }
11+ this . scroll_disabled = false
1112 this . close = this . close . bind ( this )
13+ this . prevent_scroll = this . prevent_scroll . bind ( this )
14+ }
15+
16+ prevent_scroll ( e ) {
17+ if ( ! this . scroll_disabled ) {
18+ this . scroll_disabled = true
19+ document . body . style . overflow = 'hidden'
20+ e . preventDefault ( )
21+ }
1222 }
1323
1424 componentWillMount ( ) {
1525 this . body_overflow_before = document . body . style . overflow
16- document . body . style . overflow = 'hidden'
26+ window . onwheel = this . prevent_scroll
27+ window . onmousewheel = document . onmousewheel = this . prevent_scroll
28+ window . ontouchmove = this . prevent_scroll
1729 }
1830
1931 componentWillUnmount ( ) {
2032 document . body . style . overflow = this . body_overflow_before
33+ window . onwheel = null
34+ window . onmousewheel = document . onmousewheel = null
35+ window . ontouchmove = null
2136 }
2237
2338 close ( ) {
You can’t perform that action at this time.
0 commit comments