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.

37 lines (33 loc) 1.56 kB
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-1odky8u-0" })(["display:flex;justify-content:center;position:relative;width:100%;"]); const StyledInner = styled.div.withConfig({ displayName: "ItinerarySeparator__StyledInner", componentId: "sc-1odky8u-1" })(["", ""], ({ theme }) => css(["&:before,&:after{content:\"\";z-index:-1;position:absolute;top:50%;width:50%;height:1px;background:", ";}&:before{left:0;}&:after{right:0;}"], theme.orbit.paletteCloudDark)); // $FlowFixMe: https://github.com/flow-typed/flow-typed/issues/3653#issuecomment-568539198 StyledInner.defaultProps = { theme: defaultTheme }; const StyledWord = styled.div.withConfig({ displayName: "ItinerarySeparator__StyledWord", componentId: "sc-1odky8u-2" })(["", ""], ({ theme }) => css(["background:", ";padding:0 2px;z-index:2;"], theme.orbit.paletteWhite)); // $FlowFixMe: https://github.com/flow-typed/flow-typed/issues/3653#issuecomment-568539198 StyledWord.defaultProps = { theme: defaultTheme }; const ItinerarySeparator = ({ children }) => { if (children) return /*#__PURE__*/React.createElement(StyledWrapper, null, /*#__PURE__*/React.createElement(StyledInner, null, /*#__PURE__*/React.createElement(StyledWord, null, children))); return /*#__PURE__*/React.createElement(Divider, null); }; export default ItinerarySeparator;