@kiwicom/orbit-components
Version:
Orbit-components is a React component library which provides developers with the easiest possible way of building Kiwi.com's products.
35 lines (34 loc) • 929 B
JavaScript
"use client";
import * as React from "react";
import KEY_CODE_MAP from "../common/keyMaps";
const SkipLink = ({
links,
buttonLabel,
dataTest,
id
}) => {
return /*#__PURE__*/React.createElement("nav", {
"aria-label": buttonLabel,
"data-test": dataTest,
id: id
}, links && links.map(({
href,
name,
onClick
}, index) => {
return /*#__PURE__*/React.createElement("a", {
className: "orbit-skip-link ltr:left-400 rtl:right-400 top-400 p-400 bg-white-normal z-onTop font-base text-large rounded-100 text-ink-dark absolute underline [&:not(:focus)]:sr-only",
key: encodeURIComponent(name + index),
href: href,
tabIndex: onClick && 0,
role: href ? "link" : "button",
onClick: onClick,
onKeyDown: ev => {
if (ev.keyCode === KEY_CODE_MAP.ENTER && onClick) {
onClick(ev);
}
}
}, name);
}));
};
export default SkipLink;