import React, { FunctionComponent } from "react"; import classNames from "classnames"; import PropTypes from "prop-types"; import Icon from "react-oui-icons"; import Link from "../Link"; export type NavigationProps = { /** CSS class names. */ className?: string; /** Navigates to this URL when the help icon is clicked */ helpUrl?: string; /** Navigates to this URL when the logo clicked */ homeUrl?: string; /** Brand logo image url */ logoUrl?: string; /** Function called when the help icon is clicked */ onHelpClick?: (event: Event, url?: string) => void; /** Navigation bar style. Can be one of these: * - light * - dark * dark by default */ theme?: "light" | "dark"; /** Navigation bar title */ title: string; } export const Navigation: FunctionComponent = ({ className, helpUrl, homeUrl, logoUrl, onHelpClick = () => null, theme="dark", title, ...props }: NavigationProps) => { const themeClass = `axiom-navigation--${theme}` const classes = classNames({ "axiom-navigation": true, "flex": true, "flex-align--center": true, [themeClass]: true, }, className); const onAppRouteLinkClick: (...args: any[]) => any = event => { return onHelpClick(event, helpUrl); }; return ( ); }; Navigation.propTypes = { className: PropTypes.string, helpUrl: PropTypes.string, homeUrl: PropTypes.string, logoUrl: PropTypes.string, onHelpClick: PropTypes.func, theme: PropTypes.oneOf(["dark", "light"]), title: PropTypes.string.isRequired, };