Add side drawer to display feature guide
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import React from "react";
|
||||
import "../styles/globals.css";
|
||||
import "../styles/editor.css";
|
||||
import "../styles/mosaic.scss";
|
||||
@ -5,17 +6,24 @@ import "@blueprintjs/core/lib/css/blueprint.css";
|
||||
import "@blueprintjs/icons/lib/css/blueprint-icons.css";
|
||||
import "react-mosaic-component/react-mosaic-component.css";
|
||||
import type { AppProps } from "next/app";
|
||||
import { DarkModeProvider } from "../ui/providers/dark-mode-provider";
|
||||
import { ErrorBoundaryProvider } from "../ui/providers/error-boundary-provider";
|
||||
import { Providers } from "../ui/providers";
|
||||
import { NextPage } from "next";
|
||||
|
||||
function MyApp({ Component, pageProps }: AppProps) {
|
||||
return (
|
||||
<ErrorBoundaryProvider>
|
||||
<DarkModeProvider>
|
||||
<Component {...pageProps} />
|
||||
</DarkModeProvider>
|
||||
</ErrorBoundaryProvider>
|
||||
);
|
||||
/** Type for pages that use a custom layout */
|
||||
export type NextPageWithLayout = NextPage & {
|
||||
getLayout?: (page: React.ReactNode) => React.ReactNode;
|
||||
};
|
||||
|
||||
/** AppProps type but extended for custom layouts */
|
||||
type AppPropsWithLayout = AppProps & {
|
||||
Component: NextPageWithLayout;
|
||||
};
|
||||
|
||||
function MyApp({ Component, pageProps }: AppPropsWithLayout) {
|
||||
// Use the layout defined at the page level, if available
|
||||
const getLayout =
|
||||
Component.getLayout ?? ((page) => <Providers>{page}</Providers>);
|
||||
return getLayout(<Component {...pageProps} />);
|
||||
}
|
||||
|
||||
export default MyApp;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React from "react";
|
||||
import { NextPage } from "next";
|
||||
import { NextPageWithLayout } from "./_app";
|
||||
import Head from "next/head";
|
||||
import logoImg from "../ui/assets/logo.png";
|
||||
import Image from "next/image";
|
||||
@ -8,6 +8,7 @@ import Link from "next/link";
|
||||
import { useDarkMode } from "../ui/providers/dark-mode-provider";
|
||||
import LANGUAGES from "./languages.json";
|
||||
import { GitHubIcon } from "../ui/custom-icons";
|
||||
import { Providers } from "../ui/providers";
|
||||
|
||||
const REPO_URL = "https://github.com/nilaymaj/esolang-park";
|
||||
const WIKI_URL = REPO_URL + "/wiki";
|
||||
@ -50,7 +51,7 @@ const styles = {
|
||||
},
|
||||
};
|
||||
|
||||
const Index: NextPage = () => {
|
||||
const Index: NextPageWithLayout = () => {
|
||||
const DarkMode = useDarkMode();
|
||||
const backgroundColor = DarkMode.isDark ? Colors.DARK_GRAY3 : Colors.WHITE;
|
||||
|
||||
@ -113,4 +114,9 @@ const Index: NextPage = () => {
|
||||
);
|
||||
};
|
||||
|
||||
// Feature guide should not be shown on the home page
|
||||
Index.getLayout = function getLayout(page: React.ReactNode) {
|
||||
return <Providers omitFeatureGuide={true}>{page}</Providers>;
|
||||
};
|
||||
|
||||
export default Index;
|
||||
|
Reference in New Issue
Block a user