Remove "forwardRef" usage
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
import ListItemIcon from '@mui/material/ListItemIcon';
|
||||
import MenuItem, { MenuItemProps as MuiMenuItemProps } from '@mui/material/MenuItem';
|
||||
import { SxProps, Theme } from '@mui/material/styles';
|
||||
import React, { forwardRef, RefObject } from 'react';
|
||||
import React, { Ref } from 'react';
|
||||
|
||||
import { OverridableComponent } from '@mui/material/OverridableComponent';
|
||||
import { SvgIconTypeMap } from '@mui/material/SvgIcon';
|
||||
@@ -27,25 +27,31 @@ type IconMenuItemProps = {
|
||||
renderLabel?: () => React.ReactNode;
|
||||
LeftIcon?: OverridableComponent<SvgIconTypeMap> & { muiName: string };
|
||||
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
||||
ref?: RefObject<HTMLLIElement | null>;
|
||||
ref?: Ref<HTMLLIElement | null>;
|
||||
RightIcon?: OverridableComponent<SvgIconTypeMap> & { muiName: string };
|
||||
sx?: SxProps<Theme>;
|
||||
};
|
||||
|
||||
export const IconMenuItem = forwardRef<HTMLLIElement, IconMenuItemProps>(
|
||||
({ MenuItemProps, className, label, LeftIcon, renderLabel, RightIcon, ...props }, ref) => (
|
||||
<MenuItem {...MenuItemProps} ref={ref} className={className} {...props}>
|
||||
{LeftIcon && (
|
||||
<ListItemIcon>
|
||||
<LeftIcon fontSize="small" />
|
||||
</ListItemIcon>
|
||||
)}
|
||||
<ListItemText>{label}</ListItemText>
|
||||
{RightIcon && (
|
||||
<ListItemIcon style={{ minWidth: 0 }}>
|
||||
<RightIcon fontSize="small" />
|
||||
</ListItemIcon>
|
||||
)}
|
||||
</MenuItem>
|
||||
),
|
||||
export const IconMenuItem = ({
|
||||
MenuItemProps,
|
||||
className,
|
||||
label,
|
||||
LeftIcon,
|
||||
renderLabel,
|
||||
RightIcon,
|
||||
...props
|
||||
}: IconMenuItemProps) => (
|
||||
<MenuItem {...MenuItemProps} className={className} {...props}>
|
||||
{LeftIcon && (
|
||||
<ListItemIcon>
|
||||
<LeftIcon fontSize="small" />
|
||||
</ListItemIcon>
|
||||
)}
|
||||
<ListItemText>{label}</ListItemText>
|
||||
{RightIcon && (
|
||||
<ListItemIcon style={{ minWidth: 0 }}>
|
||||
<RightIcon fontSize="small" />
|
||||
</ListItemIcon>
|
||||
)}
|
||||
</MenuItem>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user