UNPKG

1.08 kBJavaScriptView Raw
1import { __rest } from "tslib";
2import * as React from 'react';
3import styles from '@patternfly/react-styles/css/components/Nav/nav';
4import { css } from '@patternfly/react-styles';
5import { getUniqueId } from '../../helpers/util';
6export const NavGroup = (_a) => {
7 var { title, children = null, className = '', id = getUniqueId() } = _a, props = __rest(_a, ["title", "children", "className", "id"]);
8 if (!title && !props['aria-label']) {
9 // eslint-disable-next-line no-console
10 console.warn("For accessibility reasons an aria-label should be specified on nav groups if a title isn't");
11 }
12 const labelledBy = title ? id : undefined;
13 return (React.createElement("section", Object.assign({ className: css(styles.navSection, className), "aria-labelledby": labelledBy }, props),
14 title && (React.createElement("h2", { className: css(styles.navSectionTitle), id: id }, title)),
15 React.createElement("ul", { className: css(styles.navList, className) }, children)));
16};
17NavGroup.displayName = 'NavGroup';
18//# sourceMappingURL=NavGroup.js.map
\No newline at end of file