feat: MenuItem disabled color (#9923)

Fix #9874
This commit is contained in:
Jérémy M
2025-01-30 10:23:06 +01:00
committed by GitHub
parent 16c2d383ee
commit e7da9b6b87
4 changed files with 12 additions and 10 deletions

View File

@ -79,6 +79,7 @@ export const MenuItem = ({
LeftIcon={LeftIcon ?? undefined} LeftIcon={LeftIcon ?? undefined}
text={text} text={text}
contextualText={contextualText} contextualText={contextualText}
disabled={disabled}
/> />
</StyledMenuItemLeftContent> </StyledMenuItemLeftContent>
<div className="hoverable-buttons"> <div className="hoverable-buttons">
@ -89,7 +90,7 @@ export const MenuItem = ({
{RightIcon && ( {RightIcon && (
<RightIcon size={theme.icon.size.md} stroke={theme.icon.stroke.sm} /> <RightIcon size={theme.icon.size.md} stroke={theme.icon.stroke.sm} />
)} )}
{hasSubMenu && ( {hasSubMenu && !disabled && (
<IconChevronRight <IconChevronRight
size={theme.icon.size.sm} size={theme.icon.size.sm}
color={theme.font.color.tertiary} color={theme.font.color.tertiary}

View File

@ -51,7 +51,7 @@ export const MenuItemDraggable = ({
<MenuItemLeftContent <MenuItemLeftContent
LeftIcon={LeftIcon} LeftIcon={LeftIcon}
text={text} text={text}
isDisabled={isDragDisabled} disabled={isDragDisabled}
showGrip={showGrip} showGrip={showGrip}
/> />
{showIconButtons && ( {showIconButtons && (

View File

@ -19,7 +19,7 @@ const StyledMainText = styled.div`
`; `;
const StyledContextualText = styled.div` const StyledContextualText = styled.div`
color: ${({ theme }) => theme.color.gray35}; color: ${({ theme }) => theme.font.color.light};
font-family: inherit; font-family: inherit;
font-size: inherit; font-size: inherit;
@ -40,7 +40,7 @@ type MenuItemLeftContentProps = {
className?: string; className?: string;
LeftIcon: IconComponent | null | undefined; LeftIcon: IconComponent | null | undefined;
showGrip?: boolean; showGrip?: boolean;
isDisabled?: boolean; disabled?: boolean;
text: ReactNode; text: ReactNode;
contextualText?: ReactNode; contextualText?: ReactNode;
}; };
@ -51,7 +51,7 @@ export const MenuItemLeftContent = ({
text, text,
contextualText, contextualText,
showGrip = false, showGrip = false,
isDisabled = false, disabled = false,
}: MenuItemLeftContentProps) => { }: MenuItemLeftContentProps) => {
const theme = useTheme(); const theme = useTheme();
@ -63,7 +63,7 @@ export const MenuItemLeftContent = ({
size={theme.icon.size.md} size={theme.icon.size.md}
stroke={theme.icon.stroke.sm} stroke={theme.icon.stroke.sm}
color={ color={
isDisabled ? theme.font.color.extraLight : theme.font.color.light disabled ? theme.font.color.extraLight : theme.font.color.light
} }
/> />
</StyledDraggableItem> </StyledDraggableItem>

View File

@ -43,7 +43,11 @@ export const StyledMenuItemBase = styled.div<MenuItemBaseProps>`
(disabled || isHoverBackgroundDisabled) ?? HOVER_BACKGROUND}; (disabled || isHoverBackgroundDisabled) ?? HOVER_BACKGROUND};
${({ theme, accent, disabled }) => { ${({ theme, accent, disabled }) => {
const isDisabled = !isUndefined(disabled) && disabled !== false; if (!isUndefined(disabled) && disabled !== false) {
return css`
color: ${theme.font.color.tertiary};
`;
}
switch (accent) { switch (accent) {
case 'danger': { case 'danger': {
@ -52,20 +56,17 @@ export const StyledMenuItemBase = styled.div<MenuItemBaseProps>`
&:hover { &:hover {
background: ${theme.background.transparent.danger}; background: ${theme.background.transparent.danger};
} }
${isDisabled && `opacity: 0.4;`}
`; `;
} }
case 'placeholder': { case 'placeholder': {
return css` return css`
color: ${theme.font.color.tertiary}; color: ${theme.font.color.tertiary};
${isDisabled && `opacity: 0.4;`}
`; `;
} }
case 'default': case 'default':
default: { default: {
return css` return css`
color: ${theme.font.color.secondary}; color: ${theme.font.color.secondary};
${isDisabled && `opacity: 0.4;`}
`; `;
} }
} }