fix: Add isIconStatic prop item to allow the icons to be always rendered statically ignoring hover behaviour (#4676)
Fix #4653 --------- Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
This commit is contained in:
@ -20,6 +20,7 @@ export type MenuItemProps = {
|
|||||||
accent?: MenuItemAccent;
|
accent?: MenuItemAccent;
|
||||||
text: string;
|
text: string;
|
||||||
iconButtons?: MenuItemIconButton[];
|
iconButtons?: MenuItemIconButton[];
|
||||||
|
isIconDisplayedOnHoverOnly?: boolean;
|
||||||
isTooltipOpen?: boolean;
|
isTooltipOpen?: boolean;
|
||||||
className?: string;
|
className?: string;
|
||||||
testId?: string;
|
testId?: string;
|
||||||
@ -32,6 +33,7 @@ export const MenuItem = ({
|
|||||||
text,
|
text,
|
||||||
iconButtons,
|
iconButtons,
|
||||||
isTooltipOpen,
|
isTooltipOpen,
|
||||||
|
isIconDisplayedOnHoverOnly = true,
|
||||||
className,
|
className,
|
||||||
testId,
|
testId,
|
||||||
onClick,
|
onClick,
|
||||||
@ -53,6 +55,7 @@ export const MenuItem = ({
|
|||||||
className={className}
|
className={className}
|
||||||
accent={accent}
|
accent={accent}
|
||||||
isMenuOpen={!!isTooltipOpen}
|
isMenuOpen={!!isTooltipOpen}
|
||||||
|
isIconDisplayedOnHoverOnly={isIconDisplayedOnHoverOnly}
|
||||||
>
|
>
|
||||||
<StyledMenuItemLeftContent>
|
<StyledMenuItemLeftContent>
|
||||||
<MenuItemLeftContent LeftIcon={LeftIcon ?? undefined} text={text} />
|
<MenuItemLeftContent LeftIcon={LeftIcon ?? undefined} text={text} />
|
||||||
|
|||||||
@ -102,12 +102,14 @@ export const StyledMenuItemRightContent = styled.div`
|
|||||||
|
|
||||||
export const StyledHoverableMenuItemBase = styled(StyledMenuItemBase)<{
|
export const StyledHoverableMenuItemBase = styled(StyledMenuItemBase)<{
|
||||||
isMenuOpen: boolean;
|
isMenuOpen: boolean;
|
||||||
|
isIconDisplayedOnHoverOnly: boolean;
|
||||||
}>`
|
}>`
|
||||||
& .hoverable-buttons {
|
& .hoverable-buttons {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
right: ${({ theme }) => theme.spacing(2)};
|
right: ${({ theme }) => theme.spacing(2)};
|
||||||
opacity: 0;
|
opacity: ${({ isIconDisplayedOnHoverOnly }) =>
|
||||||
|
isIconDisplayedOnHoverOnly ? 0 : 1};
|
||||||
transition: opacity ${({ theme }) => theme.animation.duration.instant}s ease;
|
transition: opacity ${({ theme }) => theme.animation.duration.instant}s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,7 +117,6 @@ export const StyledHoverableMenuItemBase = styled(StyledMenuItemBase)<{
|
|||||||
& .hoverable-buttons {
|
& .hoverable-buttons {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
pointer-events: auto;
|
pointer-events: auto;
|
||||||
position: static;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -74,6 +74,7 @@ export const ViewPickerListContent = () => {
|
|||||||
Icon: IconLock,
|
Icon: IconLock,
|
||||||
},
|
},
|
||||||
].filter(isDefined)}
|
].filter(isDefined)}
|
||||||
|
isIconDisplayedOnHoverOnly={view.key !== 'INDEX'}
|
||||||
onClick={() => handleViewSelect(view.id)}
|
onClick={() => handleViewSelect(view.id)}
|
||||||
LeftIcon={getIcon(view.icon)}
|
LeftIcon={getIcon(view.icon)}
|
||||||
text={view.name}
|
text={view.name}
|
||||||
|
|||||||
Reference in New Issue
Block a user