File size: 2,084 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
// @flow
import * as React from "react";
import cn from "classnames";
import { Container, Grid, Nav } from "../../";
type subNavItem = {|
+value: string,
+to?: string,
+icon?: string,
+LinkComponent?: React.ElementType,
+useExact?: boolean,
|};
type navItem = {|
+value: string,
+to?: string,
+icon?: string,
+active?: boolean,
+LinkComponent?: React.ElementType,
+subItems?: Array<subNavItem>,
+useExact?: boolean,
|};
type navItems = Array<navItem>;
export type Props = {|
+children?: React.Node,
+items?: React.ChildrenArray<React.Element<typeof Nav.Item>>,
+itemsObjects?: navItems,
/**
* Display a search form to the right of the nav items
*/
+withSearchForm?: boolean,
/**
* Provide your own component to replace the search form
*/
+rightColumnComponent?: React.Node,
/**
* Toggle the collapsed state of the nav
*/
+collapse?: boolean,
+routerContextComponentType?: React.ElementType,
|};
const SiteNav = ({
children,
items,
itemsObjects,
withSearchForm = true,
rightColumnComponent,
collapse = true,
routerContextComponentType,
}: Props): React.Node => {
const classes = cn("header d-lg-flex p-0", { collapse });
return (
<div className={classes}>
<Container>
{children || (
<Grid.Row className="align-items-center">
<Grid.Col lg={3} className="ml-auto" ignoreCol={true}>
{/* @TODO: add InlineSearchForm */}
{/* {rightColumnComponent || (withSearchForm && <InlineSearchForm />)} */}
{rightColumnComponent}
</Grid.Col>
<Grid.Col className="col-lg order-lg-first">
<Nav
tabbed
className="border-0 flex-column flex-lg-row"
items={items}
itemsObjects={itemsObjects}
routerContextComponentType={routerContextComponentType}
/>
</Grid.Col>
</Grid.Row>
)}
</Container>
</div>
);
};
SiteNav.displayName = "Site.Nav";
export default SiteNav;
|