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

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

const defaultProps = {
  level: 1,
  variant: null,
  size: null
};

const NavButton = ({ 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 <Button variant={variant} size={size} {...props} />;
};

NavButton.propTypes = propTypes;
NavButton.defaultProps = defaultProps;

export default NavButton;

