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.

44 lines 1.3 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import * as React from "react"; import { TYPES } from "./consts"; import ButtonPrimitive from "../primitives/ButtonPrimitive"; import useTheme from "../hooks/useTheme"; import getIconContainer from "../primitives/ButtonPrimitive/common/getIconContainer"; import getButtonLinkStyles from "./helpers/getButtonLinkStyles"; import getButtonLinkIconForeground from "./helpers/getButtonLinkIconForeground"; import getButtonLinkCommonProps from "./helpers/getButtonLinkCommonProps"; const ButtonLink = /*#__PURE__*/React.forwardRef(({ type = TYPES.PRIMARY, size, compact = false, ...props }, ref) => { const theme = useTheme(); const propsWithTheme = { theme, size, ...props }; const commonProps = getButtonLinkCommonProps({ ...propsWithTheme, compact }); const buttonLinkStyles = getButtonLinkStyles({ type, theme, compact }); const icons = getIconContainer({ ...propsWithTheme, iconForeground: getButtonLinkIconForeground({ type, theme, compact }) }); return /*#__PURE__*/React.createElement(ButtonPrimitive, _extends({ ref: ref }, props, buttonLinkStyles, commonProps, icons)); }); ButtonLink.displayName = "ButtonLink"; export default ButtonLink;