let { Modal, DefaultButton, getId, Fabric } = window.Fabric;

interface IModalModelessExampleState {
  showModal: boolean;
}

class ModalModelessExample extends React.Component<{}, IModalModelessExampleState> {
  public state: IModalModelessExampleState = {
    showModal: false
  };
  // Use getId() to ensure that the IDs are unique on the page.
  // (It's also okay to use plain strings without getId() and manually ensure uniqueness.)
  private _titleId: string = getId('title');
  private _subtitleId: string = getId('subText');

  public render(): JSX.Element {
    return (
      <div>
        <DefaultButton secondaryText="Opens the Sample Modal" onClick={this._showModal} text="Open Modal" />
        <Modal
          titleAriaId={this._titleId}
          subtitleAriaId={this._subtitleId}
          isOpen={this.state.showModal}
          onDismiss={this._closeModal}
          isModeless={true}
          containerClassName="ms-modalStickyExample-container"
        >
          <div className="ms-modalExample-header">
            <span id={this._titleId}>Lorem Ipsum</span>
          </div>
          <div id={this._subtitleId} className="ms-modalExample-body">
            <DefaultButton onClick={this._closeModal} text="Close" />
            <p>
              Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas lorem nulla, malesuada ut sagittis sit
              amet, vulputate in leo. Maecenas vulputate congue sapien eu tincidunt. Etiam eu sem turpis. Fusce tempor
              sagittis nunc, ut interdum ipsum vestibulum non. Proin dolor elit, aliquam eget tincidunt non, vestibulum
              ut turpis. In hac habitasse platea dictumst. In a odio eget enim porttitor maximus. Aliquam nulla nibh,
              ullamcorper aliquam placerat eu, viverra et dui. Phasellus ex lectus, maximus in mollis ac, luctus vel
              eros. Vivamus ultrices, turpis sed malesuada gravida, eros ipsum venenatis elit, et volutpat eros dui et
              ante. Quisque ultricies mi nec leo ultricies mollis. Vivamus egestas volutpat lacinia. Quisque pharetra
              eleifend efficitur.{' '}
            </p>
          </div>
        </Modal>
      </div>
    );
  }

  private _showModal = (): void => {
    this.setState({ showModal: true });
  };

  private _closeModal = (): void => {
    this.setState({ showModal: false });
  };
}

ReactDOM.render(<ModalModelessExample />, document.getElementById('content'));
