diff --git a/src/components/DropdownMenuItem/index.tsx b/src/components/DropdownMenuItem/index.tsx index 8dada50a..caf2911f 100644 --- a/src/components/DropdownMenuItem/index.tsx +++ b/src/components/DropdownMenuItem/index.tsx @@ -39,6 +39,7 @@ export function Separator({ className }: { className?: string }) { interface BaseProps extends ElementFragmentProps { className?: string; + disabled?: boolean; } export type Props = BaseProps & ({ @@ -61,12 +62,14 @@ function DropdownMenuItem(props: Props actionsContainerClassName, spacing = 'comfortable', href, + disabled = false, } = props; const className = _cs( styles.dropdownMenuItem, spacingToStyleMap[spacing], classNameFromProps, + disabled && styles.disabled, ); const content = ( @@ -116,6 +119,7 @@ function DropdownMenuItem(props: Props name={props.name} // eslint-disable-next-line react/destructuring-assignment onClick={props.onClick} + disabled={disabled} > {content} diff --git a/src/components/DropdownMenuItem/styles.css b/src/components/DropdownMenuItem/styles.css index 7f0d8b45..081c2bd5 100644 --- a/src/components/DropdownMenuItem/styles.css +++ b/src/components/DropdownMenuItem/styles.css @@ -27,8 +27,13 @@ &.loose-spacing { --spacing: var(--dui-spacing-large); } -} + &.disabled { + pointer-events: none; + opacity: var(--dui-opacity-disabled-element); + filter: saturate(var(--dui-saturation-disabled-element)); + } +} .separator { margin: var(--dui-spacing-extra-small) 0; border: var(--dui-width-separator-thin) solid var(--dui-color-separator); diff --git a/storybook/stories/DropdownMenu/DropdownMenu.stories.tsx b/storybook/stories/DropdownMenu/DropdownMenu.stories.tsx index f253ce9a..235f4a6d 100644 --- a/storybook/stories/DropdownMenu/DropdownMenu.stories.tsx +++ b/storybook/stories/DropdownMenu/DropdownMenu.stories.tsx @@ -216,6 +216,35 @@ export const Variants: Story = () => ( Goto Togglecorp + + + Home + + + Profile + + + Projects + + + + Logout + + } + disabled + > + Goto Togglecorp + +