diff --git a/scm-ui/ui-components/src/navigation/SecondaryNavigation.tsx b/scm-ui/ui-components/src/navigation/SecondaryNavigation.tsx new file mode 100644 index 0000000000..0ac9cfb9e1 --- /dev/null +++ b/scm-ui/ui-components/src/navigation/SecondaryNavigation.tsx @@ -0,0 +1,45 @@ +import React, { ReactElement, ReactNode } from "react"; +import { MenuContext } from "./MenuContext"; +import SubNavigation from "./SubNavigation"; +import NavLink from "./NavLink"; + +type Props = { + to: string; + icon: string; + label: string; + title: string; + activeWhenMatch?: (route: any) => boolean; + activeOnlyWhenExact?: boolean; + children?: ReactElement[]; +}; + +export default class SecondaryNavigation extends React.Component { + render() { + const { to, icon, label, title, activeWhenMatch, activeOnlyWhenExact, children } = this.props; + if (children) { + return ( + + {({ menuCollapsed }) => ( + + {children} + + )} + + ); + } else { + return ( + + {({ menuCollapsed }) => } + + ); + } + } +} diff --git a/scm-ui/ui-components/src/navigation/index.ts b/scm-ui/ui-components/src/navigation/index.ts index 30ca96bc51..88cd0ac353 100644 --- a/scm-ui/ui-components/src/navigation/index.ts +++ b/scm-ui/ui-components/src/navigation/index.ts @@ -8,3 +8,4 @@ export { default as PrimaryNavigation } from "./PrimaryNavigation"; export { default as PrimaryNavigationLink } from "./PrimaryNavigationLink"; export { default as Section } from "./Section"; export { MenuContext, storeMenuCollapsed, isMenuCollapsed } from "./MenuContext"; +export { default as SecondaryNavigation } from "./SecondaryNavigation";