Skip to content

Commit

Permalink
Merge pull request #7577 from kristelvdakker/pr/changeable-DashboardM…
Browse files Browse the repository at this point in the history
…enuItem-icon

Changeable icon for DashboardMenuItem
  • Loading branch information
fzaninotto authored May 18, 2022
2 parents 79cf3cf + 20f3b83 commit 1ddb167
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/ra-ui-materialui/src/layout/DashboardMenuItem.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
import * as React from 'react';
import React, { ReactElement } from 'react';
import PropTypes from 'prop-types';
import DashboardIcon from '@mui/icons-material/Dashboard';
import { useTranslate, useBasename } from 'ra-core';

import { MenuItemLink } from './MenuItemLink';

export const DashboardMenuItem = (props: DashboardMenuItemProps) => {
const { locale, ...rest } = props;
const { locale, leftIcon = <DashboardIcon />, ...rest } = props;
const translate = useTranslate();
const basename = useBasename();
return (
<MenuItemLink
to={`${basename}/`}
primaryText={translate('ra.page.dashboard')}
leftIcon={<DashboardIcon />}
leftIcon={leftIcon}
{...rest}
/>
);
};

export interface DashboardMenuItemProps {
leftIcon?: ReactElement;
locale?: string;
onClick?: () => void;
dense?: boolean;
Expand All @@ -30,6 +31,7 @@ export interface DashboardMenuItemProps {
}

DashboardMenuItem.propTypes = {
leftIcon: PropTypes.element,
locale: PropTypes.string,
onClick: PropTypes.func,
dense: PropTypes.bool,
Expand Down

0 comments on commit 1ddb167

Please sign in to comment.