UNPKG

@reusable-ui/nav

Version:

A navigation component to navigate between pages.

33 lines (32 loc) 1.05 kB
// react: import { // react: default as React, } from 'react'; // reusable-ui components: import { List, } from '@reusable-ui/list'; // represents a series of content const Nav = (props) => { // rest props: const { // accessibilities: label, // components: listComponent = React.createElement(List, null), ...restListProps } = props; // jsx: /* <List> */ return React.cloneElement(listComponent, // props: { // other props: ...restListProps, ...listComponent.props, // semantics: semanticTag: listComponent.props.semanticTag ?? props.semanticTag ?? 'nav', semanticRole: listComponent.props.semanticRole ?? props.semanticRole ?? 'navigation', 'aria-label': listComponent.props['aria-label'] ?? label, // behaviors: actionCtrl: listComponent.props.actionCtrl ?? props.actionCtrl ?? true, }, // children: listComponent.props.children ?? props.children); }; export { Nav, Nav as default, };