aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/molecules/nav/nav-list/nav-list.tsx
blob: bdf7487062b179cff84b4af3b8be4683019b79c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { forwardRef, type ReactNode, type ForwardedRef } from 'react';
import { List, type ListProps } from '../../../atoms';

export type NavListProps<T extends boolean> = Omit<
  ListProps<T, false>,
  'children' | 'hideMarker'
> & {
  /**
   * The nav items.
   */
  children: ReactNode;
};

const NavListWithRef = <T extends boolean>(
  { children, isInline, ...props }: NavListProps<T>,
  ref: ForwardedRef<HTMLUListElement | HTMLOListElement>
) => (
  <List {...props} hideMarker isInline={isInline} ref={ref}>
    {children}
  </List>
);

export const NavList = forwardRef(NavListWithRef);