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.

55 lines (52 loc) 1.94 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2"; import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties"; const _excluded = ["type", "disabled", "size"]; import * as React from "react"; import ButtonPrimitive from "../primitives/ButtonPrimitive"; import getIconContainer from "../primitives/ButtonPrimitive/common/getIconContainer"; import getCommonProps from "../primitives/ButtonPrimitive/common/getCommonProps"; import ChevronRightIcon from "../icons/ChevronRight"; import useTheme from "../hooks/useTheme"; import getSocialButtonStyles from "./helpers/getSocialButtonStyles"; import getSocialButtonIconForeground from "./helpers/getSocialButtonIconForeground"; import getSocialButtonIcon from "./helpers/getSocialButtonIcon"; import { TYPE_OPTIONS } from "./consts"; const SocialButton = /*#__PURE__*/React.forwardRef((_ref, ref) => { let { type = TYPE_OPTIONS.APPLE, disabled = false, size } = _ref, props = _objectWithoutProperties(_ref, _excluded); const theme = useTheme(); const propsWithTheme = _objectSpread({ theme, size }, props); const commonProps = getCommonProps(propsWithTheme); const buttonStyles = getSocialButtonStyles({ type, disabled, theme }); const icons = getIconContainer(_objectSpread(_objectSpread({}, propsWithTheme), {}, { iconForeground: getSocialButtonIconForeground({ type, theme }) })); const iconLeft = getSocialButtonIcon(type); return /*#__PURE__*/React.createElement(ButtonPrimitive, _extends({ ref: ref }, props, commonProps, buttonStyles, icons, { disabled: disabled, iconLeft: iconLeft, iconRight: /*#__PURE__*/React.createElement(ChevronRightIcon, { color: "primary" }), circled: false })); }); SocialButton.displayName = "SocialButton"; export default SocialButton;