UNPKG

@kiwicom/orbit-components

Version:

<div align="center"> <a href="https://orbit.kiwi" target="_blank"> <img alt="orbit-components" src="https://orbit.kiwi/wp-content/uploads/2018/08/orbit-components.png" srcset="https://orbit.kiwi/wp-content/uploads/2018/08/orbit-components@2x.png 2x"

51 lines (43 loc) 1.89 kB
import * as React from "react"; import styled from "styled-components"; import defaultTokens from "../defaultTokens"; import { SIZES, TYPES } from "./consts"; import { StyledCarrierLogo } from "../CarrierLogo"; import getSpacingToken from "../common/getSpacingToken"; const getSizeToken = () => ({ theme, size }) => { const sizeTokens = { [SIZES.SMALL]: theme.orbit.fontSizeTextSmall, [SIZES.NORMAL]: theme.orbit.fontSizeTextNormal, [SIZES.LARGE]: theme.orbit.fontSizeTextLarge }; return sizeTokens[size]; }; const getTypeToken = () => ({ theme, type }) => { const typeTokens = { [TYPES.PRIMARY]: theme.orbit.colorTextPrimary, [TYPES.SECONDARY]: theme.orbit.colorTextSecondary }; return typeTokens[type]; }; const StyledList = styled(({ className, children, dataTest }) => React.createElement( "div", { className: className, "data-test": dataTest }, children )).withConfig({ displayName: "List__StyledList" })(["display:flex;width:100%;flex-direction:column;font-family:", ";font-size:", ";line-height:", ";color:", ";margin-bottom:", ";", "{height:", ";width:", ";img{height:", ";width:", ";}}svg{height:", ";width:", ";}"], ({ theme }) => theme.orbit.fontfamily, getSizeToken(), ({ theme }) => theme.orbit.lineHeightText, getTypeToken(), getSpacingToken, StyledCarrierLogo, ({ theme }) => theme.orbit.heightIconSmall, ({ theme }) => theme.orbit.widthIconSmall, ({ theme }) => theme.orbit.heightIconSmall, ({ theme }) => theme.orbit.widthIconSmall, ({ theme }) => theme.orbit.heightIconSmall, ({ theme }) => theme.orbit.widthIconSmall); StyledList.defaultProps = { theme: defaultTokens }; const List = ({ children, size = SIZES.NORMAL, type = TYPES.PRIMARY, dataTest, spaceAfter }) => React.createElement( StyledList, { type: type, size: size, dataTest: dataTest, spaceAfter: spaceAfter }, children ); export default List;