-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[material-ui][docs] Add improvements to Dashboard template #42445
Conversation
Netlify deploy previewhttps://deploy-preview-42445--material-ui.netlify.app/ Bundle size report |
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.
Awesome — dropping a first pass here.
docs/data/material/getting-started/templates/dashboard/components/ChartUserByCountry.js
Outdated
Show resolved
Hide resolved
docs/data/material/getting-started/templates/dashboard/components/MenuButton.tsx
Outdated
Show resolved
Hide resolved
docs/data/material/getting-started/templates/dashboard/components/Navbar.js
Outdated
Show resolved
Hide resolved
docs/data/material/getting-started/templates/dashboard/components/ToggleColorMode.tsx
Outdated
Show resolved
Hide resolved
@noraleonte I noticed that the |
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.
Great work on these improvement 🎉 I am leaving some nitpicks to finetune, let me know if you need help with any of them. 🎉
docs/data/material/getting-started/templates/dashboard/components/ChartUserByCountry.tsx
Outdated
Show resolved
Hide resolved
docs/data/material/getting-started/templates/dashboard/components/SideMenu.tsx
Show resolved
Hide resolved
docs/data/material/getting-started/templates/dashboard/components/SideMenu.tsx
Outdated
Show resolved
Hide resolved
docs/data/material/getting-started/templates/dashboard/components/SideMenu.tsx
Outdated
Show resolved
Hide resolved
docs/data/material/getting-started/templates/dashboard/components/SideMenu.tsx
Outdated
Show resolved
Hide resolved
Hey @noraleonte, thanks for the feedback! I'm still adding many changes, but I'll definitely need some help code-wise. Can you help me with these? 1. Making menus consistent:All these menus should look similar regarding states and padding. The 'Development' select is IMO the best, so if others could be like that would be amazing! 2. Some of Olivier's feedbacks:
3. Performance and best practicesThis should be the reference of best practices regarding customising Material UI and X, so it's important to review everything and reassure that:
I tried to cover all of these, but someone with a better code knowledge would likely spot some loose ends 👍 |
docs/data/material/getting-started/templates/dashboard/components/CardAlert.tsx
Show resolved
Hide resolved
sx={{ | ||
maxHeight: 56, | ||
width: 215, | ||
'&.MuiList-root': { |
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.
We should use listClasses.root
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.
Tried replacing it for:
[`&. ${listClasses.root}`]: {
p: '8px',
},
and importing it like:
import listClasses from '@mui/material/List';
However, I got the error:
Property 'root' does not exist on type 'ExtendList<ListTypeMap<{}, "ul">>'.ts(2339)
@@ -10,6 +10,21 @@ import Typography from '@mui/material/Typography'; | |||
import { SparkLineChart } from '@mui/x-charts/SparkLineChart'; | |||
import { areaElementClasses } from '@mui/x-charts/LineChart'; | |||
|
|||
function getDaysInMonth(month, year) { |
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.
The docs package has date-fns
as a dependency, could we use it for this?
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.
Just to clarify, is it a dependency for MUI/docs or for the Material UI package as well? If it's not a dependency for Material UI, I think we shouldn't include it in the templates, since we don't want to bundle extra stuff in the templates other than Material UI's dependencies.
docs/data/material/getting-started/templates/dashboard/theme/customizations/buttons.ts
Outdated
Show resolved
Hide resolved
docs/data/material/getting-started/templates/dashboard/theme/customizations/buttons.ts
Outdated
Show resolved
Hide resolved
docs/data/material/getting-started/templates/dashboard/theme/customizations/charts.ts
Outdated
Show resolved
Hide resolved
docs/data/material/getting-started/templates/dashboard/theme/customizations/datePickers.ts
Outdated
Show resolved
Hide resolved
'&:hover': { | ||
backgroundColor: theme.palette.action.hover, | ||
}, | ||
'&.Mui-selected': { |
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.
@DiegoAndai couldn't find an alternative for replacing 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.
I was also looking for an import for this class recently (commenting to get GH updates on this 👀)
boxShadow: | ||
'hsla(220, 30%, 5%, 0.07) 0px 4px 16px 0px, hsla(220, 25%, 10%, 0.07) 0px 8px 16px -5px', | ||
[`& .${buttonBaseClasses.root}`]: { | ||
'&.Mui-selected': { |
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 as above
backgroundColor: theme.palette.background.paper, | ||
boxShadow: 'none', | ||
}, | ||
[`&.${selectClasses.focused}`]: { |
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.
I'm getting an error here Property 'focused' does not exist on type 'SelectClasses'.ts(2339)
, however, it seems that selectClasses
does have a focused property 🤔
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.
Looking great. There are a few minor things I noticed:
1. The "Rows per page" select is missing a focus style
2. On the tree view, focusing on the parent elements also adds a focus style to the child elements.
product-tree.mp4
3. On the data grid, the horizontal spacing could be tightened slightly in the menu overlays. 4px left/right and 8px top/bottom?
4. The alignment looks off between the checkboxes and search field.
5. The select fields in the filter panel need some horizontal spacing, and the text input could be updated to be more in line with the select styles.
6. The data grid could use an overlay height to prevent it collapsing like this when filters are applied:
7. There is a bit of a visual glitch when grid menus open. The box-shadow is fully visible whilst the menu is animating in and out.
data-grid-shadow.mp4
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.
Looks good to me 🎉
Co-authored-by: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Co-authored-by: noraleonte <noraleonte00@gmail.com>
Closes #42610
Preview: https://deploy-preview-42445--material-ui.netlify.app/material-ui/getting-started/templates/dashboard/
Objective
👉 This is a further PR to add small tweaks and fixes to the Dashboard template after #41757.
Tasks
Adding some tweaks to the template based on Olivier's feedback #42610
Screen.Recording.2024-06-01.at.20.32.43.mov
3. Fix keyboard focus style on the tabsFixed since we removed tabs#41757 (comment)