@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.
40 lines • 1.62 kB
JavaScript
import * as React from "react";
import styled, { css } from "styled-components";
import Divider from "./Divider";
import defaultTheme from "../../defaultTheme";
const StyledWrapper = styled.div.withConfig({
displayName: "ItinerarySeparator__StyledWrapper",
componentId: "sc-2l0mf-0"
})(["display:flex;justify-content:center;position:relative;width:100%;"]);
const StyledInner = styled.div.withConfig({
displayName: "ItinerarySeparator__StyledInner",
componentId: "sc-2l0mf-1"
})(["", ""], ({
theme,
$type,
$color
}) => css(["&:before,&:after{content:\"\";position:absolute;top:50%;z-index:10;width:50%;height:", ";background:", ";border-width:", ";border-color:", ";border-style:", ";}&:before{left:0;}&:after{right:0;}"], !$type && theme.orbit.heightSeparator, theme.orbit.backgroundSeparator, $type && "1px", $color && theme.orbit[$color], $type));
StyledInner.defaultProps = {
theme: defaultTheme
};
const StyledWord = styled.div.withConfig({
displayName: "ItinerarySeparator__StyledWord",
componentId: "sc-2l0mf-2"
})(["", ";"], ({
theme
}) => css(["position:relative;padding:0 2px;background:", ";z-index:11;"], theme.orbit.paletteWhite));
StyledWord.defaultProps = {
theme: defaultTheme
};
const ItinerarySeparator = ({
children,
type,
color
}) => {
if (children || type) return /*#__PURE__*/React.createElement(StyledWrapper, null, /*#__PURE__*/React.createElement(StyledInner, {
$type: type,
$color: color
}, /*#__PURE__*/React.createElement(StyledWord, null, children)));
return /*#__PURE__*/React.createElement(Divider, null);
};
export default ItinerarySeparator;