-
-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[docs] Add Toolpad core tutorial example #3617
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"] | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can make this terser, like the Next.js examples .gitignore?