@octopusdeploy/design-system-components
Version:
The design systems component library.
13 lines (12 loc) • 860 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.NavigationBarIconLink = NavigationBarIconLink;
const jsx_runtime_1 = require("react/jsx-runtime");
const OctopusRoutingContext_1 = require("../../routing/OctopusRoutingContext");
const navigationBarStyles_1 = require("./navigationBarStyles");
function NavigationBarIconLink({ href, showLinkAsActive, icon, accessibleName }) {
const Link = (0, OctopusRoutingContext_1.useOctopusLinkComponent)();
const isUrlActive = (0, OctopusRoutingContext_1.useIsUrlActive)();
const isActive = isUrlActive(href, showLinkAsActive ?? "if path partially matches");
return ((0, jsx_runtime_1.jsx)(Link, { className: navigationBarStyles_1.navigationBarIconLinkStyles, "aria-current": isActive ? "page" : undefined, href: href, "aria-label": accessibleName, children: icon }));
}