UNPKG

@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.

67 lines (58 loc) 2.69 kB
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties"; var _src; import * as React from "react"; import styled from "styled-components"; import defaultTheme from "../defaultTheme"; import { TYPE_OPTIONS, HEIGHT, TYPE_VARIANT } from "./consts"; var StyledButtonMobileStore = styled(function (_ref) { var theme = _ref.theme, type = _ref.type, props = _objectWithoutProperties(_ref, ["theme", "type"]); return /*#__PURE__*/React.createElement("a", props, props.children); }).withConfig({ displayName: "ButtonMobileStore__StyledButtonMobileStore", componentId: "sc-1ovc44a-0" })(["display:inline-block;height:", ";"], HEIGHT); // $FlowFixMe: https://github.com/flow-typed/flow-typed/issues/3653#issuecomment-568539198 StyledButtonMobileStore.defaultProps = { theme: defaultTheme }; var src = (_src = {}, _defineProperty(_src, TYPE_VARIANT.DARK, { appStore: "https://images.kiwi.com/common/AppStoreGrayButton.png, https://images.kiwi.com/common/AppStoreGrayButton@2x.png 2x", googlePlay: "https://images.kiwi.com/common/GooglePlayGrayButton.png, https://images.kiwi.com/common/GooglePlayGrayButton@2x.png 2x" }), _defineProperty(_src, TYPE_VARIANT.LIGHT, { appStore: "https://images.kiwi.com/common/AppStoreLightButton.png, https://images.kiwi.com/common/AppStoreLightButton@2x.png 2x", googlePlay: "https://images.kiwi.com/common/GooglePlayLightButton.png, https://images.kiwi.com/common/GooglePlayLightButton@2x.png 2x" }), _src); var ButtonMobileStore = function ButtonMobileStore(_ref2) { var _ref2$type = _ref2.type, type = _ref2$type === void 0 ? TYPE_OPTIONS.APPSTORE : _ref2$type, _ref2$variant = _ref2.variant, variant = _ref2$variant === void 0 ? TYPE_VARIANT.DARK : _ref2$variant, href = _ref2.href, onClick = _ref2.onClick, dataTest = _ref2.dataTest, _ref2$alt = _ref2.alt, alt = _ref2$alt === void 0 ? "" : _ref2$alt, _ref2$stopPropagation = _ref2.stopPropagation, stopPropagation = _ref2$stopPropagation === void 0 ? false : _ref2$stopPropagation; var onClickHandler = function onClickHandler(ev) { if (stopPropagation) { ev.stopPropagation(); if (onClick) onClick(); } if (onClick) onClick(); }; return /*#__PURE__*/React.createElement(StyledButtonMobileStore, { href: href, target: "_blank", rel: "noopener noreferrer", onClick: onClickHandler, "data-test": dataTest }, /*#__PURE__*/React.createElement("img", { srcSet: src[variant][type], height: HEIGHT, alt: alt })); }; export default ButtonMobileStore;