import React from 'react';
import PropTypes from 'prop-types';
import Dropdown from '../../Dropdown';

const propTypes = {
  variant: PropTypes.string,
  level: PropTypes.oneOf([1, 2]),
  size: PropTypes.string
};
const defaultProps = {
  variant: null,
  level: 1,
  size: null
};

const NavDropdown = ({ level, variant: initialVariant, size: initialSize, ...props }) => {
  let variant;
  let size;
  if (!initialVariant) {
    variant = level === 1 ? 'dash-lagoon' : 'dash-night-blue';
  } else {
    variant = initialVariant;
  }
  if (!initialSize) {
    size = level === 1 ? 'nav-bar' : 'nav-bar-level-2';
  } else {
    size = initialSize;
  }
  return <Dropdown variant={variant} size={size} {...props} />;
};

NavDropdown.propTypes = propTypes;
NavDropdown.defaultProps = defaultProps;

NavDropdown.Trigger = Dropdown.Trigger;
NavDropdown.Content = Dropdown.Content;
NavDropdown.Item = Dropdown.Item;
NavDropdown.Separation = Dropdown.Separation;

export default NavDropdown;
