Skip to content

Commit

Permalink
fix: typing of <SideNavMenuItem /> props (#17609)
Browse files Browse the repository at this point in the history
Co-authored-by: andrew <emyarod@users.noreply.github.com>
Co-authored-by: Guilherme Datilio Ribeiro <guilhermedatilio@gmail.com>
  • Loading branch information
3 people authored Oct 11, 2024
1 parent a71040f commit 5be6c5b
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions packages/react/src/components/UIShell/SideNavMenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

import cx from 'classnames';
import PropTypes from 'prop-types';
import React, { ElementType, ForwardedRef, HTMLAttributes, Ref } from 'react';
import React, { ElementType, ForwardedRef, Ref, ComponentProps } from 'react';
import SideNavLinkText from './SideNavLinkText';
import Link from './Link';
import { usePrefix } from '../../internal/usePrefix';

interface SideNavMenuItemProps extends HTMLAttributes<HTMLElement> {
interface SideNavMenuItemProps extends ComponentProps<typeof Link> {
/**
* Specify the children to be rendered inside of the `SideNavMenuItem`
*/
Expand All @@ -39,13 +39,7 @@ interface SideNavMenuItemProps extends HTMLAttributes<HTMLElement> {
const SideNavMenuItem = React.forwardRef<HTMLElement, SideNavMenuItemProps>(
function SideNavMenuItem(props, ref: ForwardedRef<HTMLElement>) {
const prefix = usePrefix();
const {
children,
className: customClassName,
isActive,
href,
...rest
} = props;
const { children, className: customClassName, isActive, ...rest } = props;
const className = cx(`${prefix}--side-nav__menu-item`, customClassName);
const linkClassName = cx({
[`${prefix}--side-nav__link`]: true,
Expand All @@ -54,11 +48,7 @@ const SideNavMenuItem = React.forwardRef<HTMLElement, SideNavMenuItemProps>(

return (
<li className={className}>
<Link
href={href}
{...rest}
className={linkClassName}
ref={ref as Ref<ElementType>}>
<Link {...rest} className={linkClassName} ref={ref as Ref<ElementType>}>
<SideNavLinkText>{children}</SideNavLinkText>
</Link>
</li>
Expand Down

0 comments on commit 5be6c5b

Please sign in to comment.