@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.
71 lines (69 loc) • 2.6 kB
JavaScript
import * as React from "react";
import styled, { css } from "styled-components";
import convertHexToRgba from "@kiwicom/orbit-design-tokens/lib/convertHexToRgba";
import mq from "../utils/mediaQuery";
import defaultTheme from "../defaultTheme";
import Heading from "../Heading";
import Stack from "../Stack";
import Text from "../Text";
const StyledCallOutBanner = styled.div.withConfig({
displayName: "CallOutBanner__StyledCallOutBanner",
componentId: "sc-1ml9ckq-0"
})(["display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;background:", ";border-radius:", ";padding:", ";", ";", ";"], ({
theme
}) => theme.orbit.paletteWhite, ({
theme
}) => theme.orbit.borderRadiusSmall, ({
theme
}) => theme.orbit.spaceMedium, ({
onClick
}) => onClick ? css(["box-shadow:0 0 2px 0 ", ",0 1px 4px 0 ", ";transition:box-shadow ", " ease-in-out;cursor:pointer;:focus,:active,:hover{box-shadow:0 1px 4px 0 ", ",0 4px 8px 0 ", ";outline:none;}border:1px solid transparent;"], ({
theme
}) => convertHexToRgba(theme.orbit.paletteInkNormal, 16), ({
theme
}) => convertHexToRgba(theme.orbit.paletteInkNormal, 12), ({
theme
}) => theme.orbit.durationFast, ({
theme
}) => convertHexToRgba(theme.orbit.paletteInkNormal, 16), ({
theme
}) => convertHexToRgba(theme.orbit.paletteInkNormal, 12)) : css(["border:1px solid rgb(232,237,241);"]), mq.largeMobile(css(["flex-direction:row;padding:", ";"], ({
theme
}) => theme.orbit.spaceLarge)));
StyledCallOutBanner.defaultProps = {
theme: defaultTheme
};
const StyledIllustration = styled.div.withConfig({
displayName: "CallOutBanner__StyledIllustration",
componentId: "sc-1ml9ckq-1"
})(["padding-bottom:", ";", ";"], ({
theme
}) => theme.orbit.spaceMedium, mq.largeMobile(css(["padding-right:", ";padding-bottom:0;"], ({
theme
}) => theme.orbit.spaceLarge)));
StyledIllustration.defaultProps = {
theme: defaultTheme
};
const CallOutBanner = ({
children,
illustration,
actions,
title,
onClick,
tabIndex,
description,
dataTest
}) => React.createElement(StyledCallOutBanner, {
onClick: onClick,
tabIndex: (onClick || tabIndex) && (tabIndex || 0),
"data-test": dataTest
}, illustration && React.createElement(StyledIllustration, null, illustration), React.createElement(Stack, {
spacing: "natural"
}, React.createElement(Stack, {
spacing: "condensed"
}, React.createElement(Stack, {
spacing: "tight"
}, title && React.createElement(Heading, {
type: "title3"
}, title), description && React.createElement(Text, null, description)), children), actions));
export default CallOutBanner;