Conversation
| 1. Run: | ||
|
|
||
| ```bash | ||
| yarn create toolpad-app --tutorial my-first-project |
There was a problem hiding this comment.
Does it make sense to introduce a new flag for this? Perhaps we can add a tutorial example?
| yarn create toolpad-app --tutorial my-first-project | |
| yarn create toolpad-app --core --example tutorial |
| 2. Install the packages necessary for this example: | ||
|
|
||
| ```bash | ||
| yarn add -S @mui/x-data-grid @mui/x-charts @mui/toolpad-data-csv |
There was a problem hiding this comment.
Would it make sense to already include them in the package.json of the tutorial template?
…i-toolpad into docs/toolpad-core-intro
|
|
||
| <p class="description">Tutorial</p> | ||
|
|
||
| ## Steps to follow |
There was a problem hiding this comment.
Can we format the tutorial with sections, instead of a numbered list? That way we get navigation on the right.
Perhaps it makes sense to have two sections?
## bootstrapping the application
commands to get started
## creating a page
bootstrapping 1 page + making it appear in navigation
Then this is where is where we can continue with https://deploy-preview-3611--mui-toolpad-docs.netlify.app/toolpad/core/introduction/dashboard-tutorial/
|
|
||
| 4. The app has one page already created, which can be viewed by clicking on the "Go to page" button. The following page should appear: | ||
|
|
||
| {{"component": "modules/components/DocsImage.tsx", "src": "/static/toolpad/docs/core/tutorial-1.png", "alt": "Toolpad Core default page", "caption": "Default page in dashboard layout", "zoom": true, "indent": 1 }} |
There was a problem hiding this comment.
Can we replace this with a live demo of what you'd see? The demo doesn't have to actually be running a Next.js app, we can hide the source code.
|
|
||
| The newly created page can now be navigated to from the sidebar, like the following: | ||
|
|
||
| {{"component": "modules/components/DocsImage.tsx", "src": "/static/toolpad/docs/core/tutorial-2.gif", "alt": "Toolpad Core new page", "caption": "Adding pages to navigation", "zoom": true, "indent": 1 }} |
There was a problem hiding this comment.
In the case of a demo component, there is no easy way to represent the change in the page content alongside the navigation, which is what the GIF depicts
There was a problem hiding this comment.
Can't the user just click on the different navigation entries? We'll have to create router adapter for this for the demo, not sure whether that's already possible at the moment. But I suspect it could look a bit like
// in-memory router for demos
const [pathname, setPathname] = React.useState(initialPathname);
const [searchParams, setSearchParams] = React.useState(new URLSearchParams());
const navigate = React.useCallback((url, options) => {
const {pathname, searchParams} = new URL(url, window.location.href);
setPathname(pathname);
setSearchParams(searchParams);
}, [])
const routerAdapter = { pathname, searchParams, navigate }
return <AppProvider routerAdapter={routerAdapter}>{/* ... */}</AppProvider>There was a problem hiding this comment.
Can't the user just click on the different navigation entries?
They could; I meant that the dashboard content wouldn't actually change on clicking the different navigation entries in the current behaviour. Agree on using an in-memory router adapter to make navigation work for the demos.
Perhaps we can merge this and ship an improved version with an in-memory router once that is complete?
Closes [docs] Refine the
@toolpad/coredocs introduction section #3420The example referred to in the docs added by this PR is in [docs] Add Toolpad core tutorial example #3617
Create an outline for the Introduction page: https://deploy-preview-3383--mui-toolpad-docs.netlify.app/toolpad/core/introduction/