@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.
45 lines (44 loc) • 1.35 kB
JavaScript
;
"use client";
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
exports.__esModule = true;
exports.default = void 0;
var React = _interopRequireWildcard(require("react"));
var _consts = require("./consts");
const getSrc = (type, lang) => {
if (type === "appStore") return `https://images.kiwi.com/common/AppStoreButton${lang}.png, https://images.kiwi.com/common/AppStoreButton${lang}@2x.png 2x`;
return `https://images.kiwi.com/common/GooglePlayButton${lang}.png, https://images.kiwi.com/common/GooglePlayButton${lang}@2x.png 2x`;
};
const ButtonMobileStore = ({
type = _consts.TYPE_OPTIONS.APPSTORE,
lang = _consts.LANGUAGE.EN,
href,
onClick,
dataTest,
id,
alt = "",
stopPropagation = false
}) => {
const onClickHandler = ev => {
if (stopPropagation) {
ev.stopPropagation();
if (onClick) onClick(ev);
}
if (onClick) onClick(ev);
};
return /*#__PURE__*/React.createElement("a", {
className: "inline-block h-[40px]",
href: href,
target: "_blank",
rel: "noopener noreferrer",
onClick: onClickHandler,
"data-test": dataTest,
id: id
}, /*#__PURE__*/React.createElement("img", {
srcSet: getSrc(type, lang),
height: "40px",
alt: alt
}));
};
var _default = ButtonMobileStore;
exports.default = _default;