-
-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docs] Add Toolpad core tutorial example (#3617)
- Loading branch information
1 parent
be05a84
commit da0521a
Showing
13 changed files
with
290 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "next/core-web-vitals" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
.yarn/install-state.gz | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# local env files | ||
.env*.local | ||
|
||
# vercel | ||
.vercel | ||
|
||
# typescript | ||
*.tsbuildinfo | ||
next-env.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import * as React from 'react'; | ||
import { DashboardLayout } from '@toolpad/core/DashboardLayout'; | ||
|
||
export default function Layout(props: { children: React.ReactNode }) { | ||
return <DashboardLayout>{props.children}</DashboardLayout>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Typography, Container } from '@mui/material'; | ||
|
||
export default function Home() { | ||
return ( | ||
<main> | ||
<Container sx={{ mx: 4 }}> | ||
<Typography variant="h6" color="grey.800"> | ||
Dashboard content! | ||
</Typography> | ||
</Container> | ||
</main> | ||
); | ||
} |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { AppProvider } from '@toolpad/core/AppProvider'; | ||
import DashboardIcon from '@mui/icons-material/Dashboard'; | ||
import type { Navigation } from '@toolpad/core'; | ||
import theme from '../theme'; | ||
|
||
const NAVIGATION: Navigation = [ | ||
{ | ||
kind: 'header', | ||
title: 'Main items', | ||
}, | ||
{ | ||
slug: '/page', | ||
title: 'Page', | ||
icon: <DashboardIcon />, | ||
}, | ||
]; | ||
|
||
export default function RootLayout({ children }: Readonly<{ children: React.ReactNode }>) { | ||
return ( | ||
<html lang="en"> | ||
<body> | ||
<AppProvider theme={theme} navigation={NAVIGATION}> | ||
{children} | ||
</AppProvider> | ||
</body> | ||
</html> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import Link from 'next/link'; | ||
import { Button, Container, Typography, Box } from '@mui/material'; | ||
|
||
export default function Home() { | ||
return ( | ||
<Container> | ||
<Box sx={{ my: 4 }}> | ||
<Typography variant="h4" component="h1" gutterBottom> | ||
Welcome to <Link href="https://mui.com/toolpad/core/introduction">Toolpad Core!</Link> | ||
</Typography> | ||
|
||
<Typography variant="body1"> | ||
Get started by editing <code>(dashboard)/page/page.tsx</code> | ||
</Typography> | ||
|
||
<Box sx={{ mt: 2 }}> | ||
<Link href="/page"> | ||
<Button variant="contained" color="primary"> | ||
Go to Page | ||
</Button> | ||
</Link> | ||
</Box> | ||
</Box> | ||
</Container> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/// <reference types="next" /> | ||
/// <reference types="next/image-types/global" /> | ||
|
||
// NOTE: This file should not be edited | ||
// see https://nextjs.org/docs/basic-features/typescript for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = {}; | ||
export default nextConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"name": "core-test", | ||
"version": "0.1.0", | ||
"scripts": { | ||
"dev": "next dev", | ||
"build": "next build", | ||
"start": "next start", | ||
"lint": "next lint" | ||
}, | ||
"dependencies": { | ||
"react": "^18", | ||
"react-dom": "^18", | ||
"next": "^14", | ||
"@toolpad/core": "latest", | ||
"@mui/material": "^5", | ||
"@mui/icons-material": "^5", | ||
"@emotion/react": "^11", | ||
"@emotion/styled": "^11", | ||
"@emotion/cache": "^11" | ||
}, | ||
"devDependencies": { | ||
"typescript": "^5", | ||
"@types/node": "^20", | ||
"@types/react": "^18", | ||
"@types/react-dom": "^18", | ||
"eslint": "^8", | ||
"eslint-config-next": "^14" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
'use client'; | ||
import { createTheme } from '@mui/material/styles'; | ||
|
||
const defaultTheme = createTheme(); | ||
|
||
const theme = createTheme(defaultTheme, { | ||
palette: { | ||
background: { | ||
default: defaultTheme.palette.grey['50'], | ||
}, | ||
}, | ||
typography: { | ||
h6: { | ||
fontWeight: '700', | ||
}, | ||
}, | ||
components: { | ||
MuiAppBar: { | ||
styleOverrides: { | ||
root: { | ||
borderWidth: 0, | ||
borderBottomWidth: 1, | ||
borderStyle: 'solid', | ||
borderColor: defaultTheme.palette.divider, | ||
boxShadow: 'none', | ||
}, | ||
}, | ||
}, | ||
MuiList: { | ||
styleOverrides: { | ||
root: { | ||
padding: 0, | ||
}, | ||
}, | ||
}, | ||
MuiIconButton: { | ||
styleOverrides: { | ||
root: { | ||
color: defaultTheme.palette.primary.dark, | ||
padding: 8, | ||
}, | ||
}, | ||
}, | ||
MuiListSubheader: { | ||
styleOverrides: { | ||
root: { | ||
color: defaultTheme.palette.grey['600'], | ||
fontSize: 12, | ||
fontWeight: '700', | ||
height: 40, | ||
paddingLeft: 32, | ||
}, | ||
}, | ||
}, | ||
MuiListItem: { | ||
styleOverrides: { | ||
root: { | ||
paddingTop: 0, | ||
paddingBottom: 0, | ||
}, | ||
}, | ||
}, | ||
MuiListItemButton: { | ||
styleOverrides: { | ||
root: { | ||
borderRadius: 8, | ||
'&.Mui-selected': { | ||
'& .MuiListItemIcon-root': { | ||
color: defaultTheme.palette.primary.dark, | ||
}, | ||
'& .MuiTypography-root': { | ||
color: defaultTheme.palette.primary.dark, | ||
}, | ||
'& .MuiSvgIcon-root': { | ||
color: defaultTheme.palette.primary.dark, | ||
}, | ||
'& .MuiTouchRipple-child': { | ||
backgroundColor: defaultTheme.palette.primary.dark, | ||
}, | ||
}, | ||
'& .MuiSvgIcon-root': { | ||
color: defaultTheme.palette.action.active, | ||
}, | ||
}, | ||
}, | ||
}, | ||
MuiListItemText: { | ||
styleOverrides: { | ||
root: { | ||
'& .MuiTypography-root': { | ||
fontWeight: '500', | ||
}, | ||
}, | ||
}, | ||
}, | ||
MuiListItemIcon: { | ||
styleOverrides: { | ||
root: { | ||
minWidth: 34, | ||
}, | ||
}, | ||
}, | ||
MuiDivider: { | ||
styleOverrides: { | ||
root: { | ||
borderBottomWidth: 2, | ||
marginLeft: '16px', | ||
marginRight: '16px', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
||
export default theme; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"compilerOptions": { | ||
"lib": ["dom", "dom.iterable", "esnext"], | ||
"allowJs": true, | ||
"skipLibCheck": true, | ||
"strict": true, | ||
"noEmit": true, | ||
"esModuleInterop": true, | ||
"module": "esnext", | ||
"moduleResolution": "bundler", | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"jsx": "preserve", | ||
"incremental": true, | ||
"plugins": [ | ||
{ | ||
"name": "next" | ||
} | ||
], | ||
"paths": { | ||
"@/*": ["./*"] | ||
} | ||
}, | ||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], | ||
"exclude": ["node_modules"] | ||
} |