import classNames from 'classnames'; import React, { useState } from 'react'; import Collapsible from 'react-collapsible'; import { FaBars, FaTimes } from 'react-icons/fa'; import { isUrl } from '../../../utils/navigation'; import { Link } from '../Link'; import { NavbarDropdown } from '../NavbarDropdown'; import './Navbar.css'; import { Stringifiable } from 'query-string'; import { NotificationDropdown } from '../NotificationDropdown'; export interface NavbarItem { className?: string; label?: string; href?: string; target?: string; icon?: string; image?: string; isDivider?: boolean; isMenuLabel?: boolean; items?: NavbarItem[] /* NavbarItem for both the items in the navbar and the dropdown items */; isArrowless?: boolean; isRight?: boolean; isActiveOnClick?: boolean; isModal?: boolean; id?: string; header?: string; content?: string; } export interface NavbarProps { id?: string; className?: string; items: NavbarItem[]; children?: React.ReactNode /* takes a component, e.g. notification dropdown */; brandItem: NavbarItem; } export const Navbar: React.FC = ({ items = [], ...otherProps }) => { const props = { items, ...otherProps }; const [activeMobile, setActiveMobile] = useState(false); const Icon = ({ icon }) => ( ); const InternalOrExternalLink = ({ item }: { item: NavbarItem }) => { if (item.href && isUrl(item.href)) { return ( {item.icon && } {item.label} ); } else { return ( setActiveMobile(false)} > {item.icon && } {item.label} ); } }; const children = props.children ? props.children : null; return ( ); };