UNPKG

1.52 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.JumpLinksItem = void 0;
4const tslib_1 = require("tslib");
5const React = tslib_1.__importStar(require("react"));
6const react_styles_1 = require("@patternfly/react-styles");
7const jump_links_1 = tslib_1.__importDefault(require("@patternfly/react-styles/css/components/JumpLinks/jump-links"));
8const JumpLinksList_1 = require("./JumpLinksList");
9const JumpLinksItem = (_a) => {
10 var { isActive, href,
11 // eslint-disable-next-line
12 node, children, onClick, className } = _a, props = tslib_1.__rest(_a, ["isActive", "href", "node", "children", "onClick", "className"]);
13 const childrenArr = React.Children.toArray(children);
14 const sublists = childrenArr.filter(child => child.type === JumpLinksList_1.JumpLinksList);
15 children = childrenArr.filter(child => child.type !== JumpLinksList_1.JumpLinksList);
16 return (React.createElement("li", Object.assign({ className: react_styles_1.css(jump_links_1.default.jumpLinksItem, isActive && jump_links_1.default.modifiers.current, className) }, (isActive && { 'aria-current': 'location' }), props),
17 React.createElement("a", { className: jump_links_1.default.jumpLinksLink, href: href, onClick: onClick },
18 React.createElement("span", { className: jump_links_1.default.jumpLinksLinkText }, children)),
19 sublists));
20};
21exports.JumpLinksItem = JumpLinksItem;
22exports.JumpLinksItem.displayName = 'JumpLinksItem';
23//# sourceMappingURL=JumpLinksItem.js.map
\No newline at end of file