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.54 kB
import styled from "styled-components"; import React from "react"; import { StyledText } from "../../Text"; import defaultTheme from "../../defaultTheme"; import { TYPE_OPTIONS, WEIGHT_OPTIONS, ELEMENT_OPTIONS, ALIGN_OPTIONS, SIZE_OPTIONS } from "../../Text/consts"; const getColorType = ({ $type: type }) => ({ theme }) => { if (type === "secondary") return theme.orbit.colorTextSecondary; if (type === "info") return theme.orbit.paletteBlueDark; if (type === "success") return theme.orbit.paletteGreenDark; if (type === "warning") return theme.orbit.paletteOrangeDark; if (type === "critical") return theme.orbit.paletteRedDark; return theme.orbit.colorTextPrimary; }; const StyledTemporaryText = styled(StyledText).withConfig({ displayName: "ItineraryTemporaryText__StyledTemporaryText", componentId: "sc-1n8lhs1-0" })(["color:", ";"], getColorType); const TemporaryText = ({ type = TYPE_OPTIONS.PRIMARY, size = SIZE_OPTIONS.NORMAL, weight = WEIGHT_OPTIONS.NORMAL, align = ALIGN_OPTIONS.LEFT, as = ELEMENT_OPTIONS.P, uppercase, italic, strikeThrough, spaceAfter, children, withBackground }) => { return /*#__PURE__*/React.createElement(StyledTemporaryText, { $type: type, size: size, weight: weight, align: align, as: as, uppercase: uppercase, italic: italic, strikeThrough: strikeThrough, spaceAfter: spaceAfter, withBackground: withBackground }, children); }; StyledTemporaryText.defaultProps = { theme: defaultTheme }; export default TemporaryText;