-
-
Notifications
You must be signed in to change notification settings - Fork 5.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
[Doc] Add documentation for the Menu component #7907
Conversation
fzaninotto
commented
Jun 28, 2022
@@ -47,17 +50,25 @@ const App = () => ( | |||
| `appBar` | Optional | `Component` | - | A React component rendered at the top of the layout | | |||
| `className` | Optional | `string` | - | Passed to the root `<div>` component | | |||
| `error` | Optional | `Component` | - | A React component rendered in the content area in case of error | | |||
| `sidebar` | Optional | `Component` | - | A React component rendered at the side of the screen | |
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.
Even if the sidebar
prop exists, I see no reason to use it, so let's make it a private API. menu
, on the other side, is the preferred way to set a custom menu, so it should be documented.
export const Menu = (props: MenuProps) => { | ||
const resources = useResourceDefinitions(); | ||
const getResourceLabel = useGetResourceLabel(); | ||
const createPath = useCreatePath(); | ||
const { | ||
hasDashboard, | ||
dense, |
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.
passed as rest props to the root component, a mui MenuList
@@ -84,14 +105,18 @@ Menu.propTypes = { | |||
hasDashboard: PropTypes.bool, | |||
}; | |||
|
|||
// re-export MenuItem commponents for convenience | |||
Menu.Item = MenuItemLink; |
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.
This is technically a new feature but I think it's really minor, plus it's backwards compatible.
@@ -137,17 +137,16 @@ export const MenuItemLink = forwardRef((props: MenuItemLinkProps, ref) => { | |||
); | |||
}); | |||
|
|||
interface Props { |
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.
This change is required to let TS compile the Menu component after it reexports the MenuItem component.
Co-authored-by: Jean-Baptiste Kaiser <jb@marmelab.com>