DefinitelyTyped/types/react-modal/react-modal-tests.tsx
Uwe Wiemer ec574e7dad [react-modal] Updated typings to match v2.2.2 (#18628)
* Updated react-modal typings to match v2.2.2

* Fixed tests and CI issues

* Fixed spacing

* Added missing semicolon
2017-08-14 14:17:06 -07:00

64 lines
1.5 KiB
TypeScript

import * as React from "react";
import ReactModal from 'react-modal';
class ExampleOfUsingReactModal extends React.Component {
render() {
const onAfterOpenFn = () => { };
const onRequestCloseFn = () => { };
const customStyle = {
overlay: {
position: 'fixed',
top: 0,
left: 0,
right: 0,
bottom: 0,
backgroundColor: 'rgba(255, 255, 255, 0.75)'
},
content: {
position: 'absolute',
top: '40px',
left: '40px',
right: '40px',
bottom: '40px',
border: '1px solid #ccc',
background: '#fff',
overflow: 'auto',
WebkitOverflowScrolling: 'touch',
borderRadius: '4px',
outline: 'none',
padding: '20px'
}
};
const customClasses = {
afterOpen: 'afterOpen',
base: 'base',
beforeClose: 'beforeClose'
};
const customOverlayClasses = {
afterOpen: 'afterOpen',
base: 'base',
beforeClose: 'beforeClose'
};
const customAriaVariables = {
labelledby: 'labelledby',
describedby: 'describedby'
};
return (
<ReactModal
isOpen={true}
onAfterOpen={onAfterOpenFn}
onRequestClose={onRequestCloseFn}
closeTimeoutMS={1000}
style={customStyle}
className={customClasses}
overlayClassName={customOverlayClasses}
bodyOpenClassName={'bodyOpenClassName'}
aria={customAriaVariables}
>
<h1>Modal Content</h1>
<p>Etc.</p>
</ReactModal>
);
}
}