Skip to content

Commit

Permalink
fix: add forwardRef
Browse files Browse the repository at this point in the history
  • Loading branch information
asabotovich committed Aug 14, 2024
1 parent a83be29 commit b580c29
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions src/harmony/NavigationSidebar/NavigationItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,29 @@ import React, { FC, HTMLAttributes } from 'react';
import cn from 'classnames';

import { ListViewItem } from '../ListView/ListView';
import { Link } from '../Link/Link';
import { MenuItem } from '../MenuItem/MenuItem';

import s from './NavigationSidebar.module.css';

interface NavigationItemProps extends HTMLAttributes<HTMLDivElement> {
href: string;
value: string;
selected?: boolean;
}

export const NavigationItem: FC<NavigationItemProps> = ({ selected, href, children, ...rest }) => (
export const NavigationItem: FC<NavigationItemProps> = ({ selected, value, children, ...rest }) => (
<ListViewItem
value={href}
value={value}
renderItem={({ hovered, active, ...props }) => (
<Link view="primary" className={s.NavigationItemLink}>
<MenuItem
hovered={active || hovered}
className={cn({
[s.MenuItem_active]: selected,
})}
{...props}
{...rest}
>
{children}
</MenuItem>
</Link>
<MenuItem
hovered={active || hovered}
className={cn({
[s.MenuItem_active]: selected,
})}
{...props}
{...rest}
>
{children}
</MenuItem>
)}
/>
);

0 comments on commit b580c29

Please sign in to comment.