Skip to content
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

Merged
merged 4 commits into from
Jun 29, 2022
Merged

[Doc] Add documentation for the Menu component #7907

merged 4 commits into from
Jun 29, 2022

Conversation

fzaninotto
Copy link
Member

image

@fzaninotto fzaninotto added the RFR Ready For Review label 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 |
Copy link
Member Author

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,
Copy link
Member Author

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;
Copy link
Member Author

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 {
Copy link
Member Author

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.

docs/Admin.md Outdated Show resolved Hide resolved
docs/Layout.md Outdated Show resolved Hide resolved
docs/Layout.md Outdated Show resolved Hide resolved
docs/Menu.md Outdated Show resolved Hide resolved
docs/Menu.md Outdated Show resolved Hide resolved
packages/ra-ui-materialui/src/layout/Menu.tsx Show resolved Hide resolved
Co-authored-by: Jean-Baptiste Kaiser <jb@marmelab.com>
@slax57 slax57 added this to the 4.2.1 milestone Jun 29, 2022
@slax57 slax57 merged commit 0a91419 into master Jun 29, 2022
@slax57 slax57 deleted the layout-doc branch June 29, 2022 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants