Skip to content

Commit c75bf6c

Browse files
committed
Commit Layout
1 parent 4df630e commit c75bf6c

File tree

11 files changed

+801
-155
lines changed

11 files changed

+801
-155
lines changed

pages/_app.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { MuiThemeProvider } from "@material-ui/core/styles";
55
import CssBaseline from "@material-ui/core/CssBaseline";
66
import wrapper from "../src/store";
77
import theme from "../src/utils/theme";
8+
import MiniDrawer from "../src/layouts/admin";
89

910
class _App extends App {
1011
static async getInitialProps({ Component, ctx }) {
@@ -27,6 +28,7 @@ class _App extends App {
2728

2829
render() {
2930
const { Component, pageProps } = this.props;
31+
const Layout = Component.layout || (({ children }) => <>{children}</>);
3032

3133
return (
3234
<MuiThemeProvider theme={theme}>
@@ -40,7 +42,9 @@ class _App extends App {
4042
<title>NextJS - With Redux and Material UI</title>
4143
</Head>
4244
<CssBaseline />
43-
<Component {...pageProps} />
45+
<Layout>
46+
<Component {...pageProps} />
47+
</Layout>
4448
</MuiThemeProvider>
4549
);
4650
}

pages/dashboard.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from "react";
2+
import Admin from "../src/layouts/admin";
3+
import Orders from "../src/components/orders";
4+
5+
export default function Dashboard() {
6+
return (
7+
<>
8+
<Orders />
9+
</>
10+
);
11+
}
12+
13+
Dashboard.layout = Admin;

0 commit comments

Comments
 (0)