import React from 'react';
import { clsx } from 'clsx';

import { forwardRef } from '../utils/react';
import { Box } from '../box';
import * as css from './menu.css';

/*-- Types --*/

export interface MenuProps {
  compact?: boolean;
}

/*-- Main --*/

export const Menu = forwardRef<'ul', MenuProps>(function Menu(
  { as = 'ul', children, className, compact, ...rest },
  ref,
) {
  const cn = clsx(className, css.menu({ compact }));

  return (
    <Box ref={ref} as={as} className={cn} {...rest}>
      {children}
    </Box>
  );
});
