-
-
Notifications
You must be signed in to change notification settings - Fork 323
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] Start Toolpad Core docs #3383
Conversation
1. Run: | ||
|
||
```bash | ||
yarn create toolpad-app --tutorial my-first-project |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for this one?
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
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.
Sure
Closes [docs] Refine the
@toolpad/core
docs 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/