import React, {KeyboardEvent, ReactElement, ReactNode} from "react"; import styles from "./Navbar.pcss"; import {Link as RouterLink} from "spotlight/admin-common/components/Link"; import {classMap} from "spotlight/utils/jsx/classes"; import {ProPill as OgProPill} from "spotlight/admin-common/components/ProPill/ProPill"; import {SpotlightLogo} from "spotlight/admin-common/components/SpotlightLogo/SpotlightLogo"; import {ParsedQuery} from "query-string"; interface Props { children: [ReactElement, ReactElement | null]; } export function Navbar({children}: Props) { return (
{children[0]}
{children[1] && (
{children[1]}
)}
); } export namespace Navbar { interface ItemProps { children?: ReactNode; } export const LogoItem = () => ( <>
); export const Item = ({children}: ItemProps) => (
{children}
); export const Section = ({children}: ItemProps) => (
{children}
); interface LinkProps { linkTo?: ParsedQuery; onClick?: () => void; isCurrent?: boolean; isDisabled?: boolean; children: ReactNode; } export const Link = ({linkTo, onClick, isCurrent, isDisabled, children}: LinkProps) => { const className = classMap({ [styles.link]: true, [styles.current]: isCurrent, [styles.disabled]: isDisabled, }); const handleClick = () => !isDisabled && onClick && onClick(); const handleKey = (e: KeyboardEvent) => { if (e.key === "Enter" || e.key === " ") { e.currentTarget.click(); } }; const tabIndex = isDisabled ? -1 : 0; return ( {linkTo ? ( {children} ) : (
{children}
)}
); }; export const ProPill = () => (
); export const Chevron = () => (
); }