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.

51 lines 1.69 kB
import _extends from "@babel/runtime/helpers/esm/extends"; 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 ChevronForwardIcon from "../icons/ChevronForward"; 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(({ type = TYPE_OPTIONS.APPLE, disabled = false, size, ...props }, ref) => { const theme = useTheme(); const propsWithTheme = { theme, size, ...props }; const commonProps = getCommonProps(propsWithTheme); const buttonStyles = getSocialButtonStyles({ type, disabled, theme }); const icons = getIconContainer({ ...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(ChevronForwardIcon, { customColor: type === TYPE_OPTIONS.APPLE ? "#FFF" : "", color: "primary" }), circled: false })); }); SocialButton.displayName = "SocialButton"; export default SocialButton;