1- import React , { Component } from 'react' ;
2- import { BuildTrigger } from '../../modals/buttons/buildbutton/BuildTrigger' ;
3- import { BuildForm } from '../../modals/form/BuildForm' ;
4-
5- // TODO: To MainCanvas
6-
7- export class Container extends Component {
8- state = { isShown : false } ;
9-
10- showModal = ( ) => {
11- this . setState ( { isShown : true } , ( ) => {
12- this . closeModal = this . closeModal . bind ( this ) ;
13- this . closeButton . focus ( ) ;
14- } ) ;
15- this . toggleScrollLock ( ) ;
16- } ;
17-
18- onCloseModal = ( ) => {
19- this . setState ( { isShown : false } ) ;
20- this . toggleScrollLock ( ) ;
21-
22- }
23-
24- onClickOutside = ( e ) => {
25- if ( this . modalRef && ! this . modalRef . contains ( e . target ) ) {
26- this . onCloseModal ( ) ;
27- }
28- }
29-
30- onKeyDown = ( e ) => {
31- if ( e . key === 'Escape' ) {
32- this . onCloseModal ( ) ;
33- }
34-
35- else {
36- switch ( e . key ) {
37- case 'Enter' : {
38-
39- break ;
40- }
41- case 'ArrowUp' : {
42-
43- break ;
44- }
45- case 'ArrowDown' : {
46-
47- break ;
48- }
49- default :
50- break ;
51- }
52- }
53- }
54-
55- toggleScrollLock = ( ) => {
56- document . querySelector ( 'html' ) . classList . toggle ( 'scroll-lock' ) ;
57- }
58-
59-
60- render ( ) {
61- return (
62- < React . Fragment >
63- < BuildTrigger triggerID = "bar" buttonRef = { this . buttonRef } showModal = { this . showModal } onSubmit = { this . onSubmit } />
64- { this . state . isShown ? (
65- < BuildForm
66- onSubmit = { this . onSubmit }
67- onCloseModal = { this . onCloseModal }
68- onClickOutside = { this . onClickOutside }
69- onKeyDown = { this . onKeyDown }
70- />
71- ) : null }
72- </ React . Fragment >
73- )
74- }
75- }
76-
77-
78-
79- export default Container ;
1+ // import React, {Component} from 'react';
2+ // import {BuildTrigger} from '../../modals/buttons/buildbutton/BuildTrigger';
3+ // import {BuildForm} from '../../modals/form/BuildForm';
4+ //
5+ // // TODO: To MainCanvas
6+ //
7+ // export class Container extends Component {
8+ // state = {isShown: false};
9+ //
10+ // showModal = () => {
11+ // this.setState({isShown: true}, () => {
12+ // this.closeModal = this.closeModal.bind(this);
13+ // this.closeButton.focus();
14+ // });
15+ // this.toggleScrollLock();
16+ // };
17+ //
18+ // onCloseModal = () => {
19+ // this.setState({isShown: false});
20+ // this.toggleScrollLock();
21+ //
22+ // }
23+ //
24+ // onClickOutside = (e) => {
25+ // if (this.modalRef && !this.modalRef.contains(e.target)) {
26+ // this.onCloseModal();
27+ // }
28+ // }
29+ //
30+ // onKeyDown = (e) => {
31+ // if (e.key === 'Escape') {
32+ // this.onCloseModal();
33+ // }
34+ //
35+ // else {
36+ // switch (e.key) {
37+ // case 'Enter': {
38+ //
39+ // break;
40+ // }
41+ // case 'ArrowUp': {
42+ //
43+ // break;
44+ // }
45+ // case 'ArrowDown': {
46+ //
47+ // break;
48+ // }
49+ // default:
50+ // break;
51+ // }
52+ // }
53+ // }
54+ //
55+ // toggleScrollLock = () => {
56+ // document.querySelector('html').classList.toggle('scroll-lock');
57+ // }
58+ //
59+ //
60+ // render() {
61+ // return (
62+ // <React.Fragment>
63+ // <BuildTrigger triggerID = "bar" buttonRef = {this.buttonRef} showModal = {this.showModal} onSubmit = {this.onSubmit}/>
64+ // {this.state.isShown ? (
65+ // <BuildForm
66+ // onSubmit = {this.onSubmit}
67+ // onCloseModal = {this.onCloseModal}
68+ // onClickOutside = {this.onClickOutside}
69+ // onKeyDown = {this.onKeyDown}
70+ // />
71+ // ) : null}
72+ // </React.Fragment>
73+ // )
74+ // }
75+ // }
76+ //
77+ //
78+ //
79+ // export default Container;
0 commit comments