mirror of
https://github.com/filecoin-project/slate.git
synced 2024-12-26 02:24:44 +03:00
0c4ecd9025
- feat(_document): render portals in the div element with id browser_extension - feat(ModalPortal): useReactDom.createPortal to render childrens
27 lines
709 B
JavaScript
27 lines
709 B
JavaScript
import Document, { Html, Head, Main, NextScript } from "next/document";
|
|
|
|
class MyDocument extends Document {
|
|
static async getInitialProps(ctx) {
|
|
const initialProps = await Document.getInitialProps(ctx);
|
|
return { ...initialProps };
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<Html>
|
|
<Head />
|
|
<body>
|
|
{/** NOTE(amine): used to communicate with the extension via classNames.
|
|
* e.g. if the extension is installed on the user's browser, it will add 'isDownloaded' to className*/}
|
|
<div id="browser_extension" />
|
|
<Main />
|
|
<div id="modals_portal" />
|
|
<NextScript />
|
|
</body>
|
|
</Html>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default MyDocument;
|