mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-21 03:22:11 +00:00
Popup decoupled from app
This commit is contained in:
parent
a06423f0ec
commit
3732b1e427
3 changed files with 4 additions and 2 deletions
|
|
@ -1,10 +1,11 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
|
import classnames from 'classnames';
|
||||||
import { FocusableProvider } from 'stremio-common';
|
import { FocusableProvider } from 'stremio-common';
|
||||||
|
|
||||||
const Modal = (props) => ReactDOM.createPortal(
|
const Modal = (props) => ReactDOM.createPortal(
|
||||||
<FocusableProvider>
|
<FocusableProvider>
|
||||||
<div {...props} />
|
<div {...props} className={classnames(Modal.className, props.className)} />
|
||||||
</FocusableProvider>,
|
</FocusableProvider>,
|
||||||
Modal.container
|
Modal.container
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -225,7 +225,7 @@ class Popup extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal className={classnames('modal-container', this.props.className)} onClick={this.close}>
|
<Modal className={this.props.className} onClick={this.close}>
|
||||||
<div ref={this.menuContainerRef} className={styles['menu-container']} onClick={this.menuContainerOnClick}>
|
<div ref={this.menuContainerRef} className={styles['menu-container']} onClick={this.menuContainerOnClick}>
|
||||||
<div ref={this.menuScrollRef} className={styles['menu-scroll-container']}>
|
<div ref={this.menuScrollRef} className={styles['menu-scroll-container']}>
|
||||||
{React.cloneElement(children, { ref: this.menuChildrenRef })}
|
{React.cloneElement(children, { ref: this.menuChildrenRef })}
|
||||||
|
|
|
||||||
|
|
@ -6,5 +6,6 @@ import App from './app';
|
||||||
const container = document.getElementById('app');
|
const container = document.getElementById('app');
|
||||||
|
|
||||||
Modal.container = container;
|
Modal.container = container;
|
||||||
|
Modal.className = 'modal-container';
|
||||||
|
|
||||||
ReactDOM.render(<App />, container);
|
ReactDOM.render(<App />, container);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue