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.

69 lines (67 loc) 2.61 kB
import * as React from "react"; import styled, { css } from "styled-components"; import defaultTheme from "../../../defaultTheme"; import Heading, { StyledHeading } from "../../../Heading"; import Text from "../../../Text"; import { rtlSpacing } from "../../../utils/rtl"; import media from "../../../utils/mediaQuery"; export var StyledCardHeader = styled.div.withConfig({ displayName: "CardHeader__StyledCardHeader", componentId: "sc-4ssel7-0" })(["position:relative;width:100%;padding:", ";box-sizing:border-box;color:", ";", ""], function (_ref) { var theme = _ref.theme; return theme.orbit.spaceMedium; }, function (_ref2) { var theme = _ref2.theme; return theme.orbit.colorHeading; }, media.desktop(css(["padding:", ";"], function (_ref3) { var theme = _ref3.theme; return theme.orbit.spaceLarge; }))); StyledCardHeader.defaultProps = { theme: defaultTheme }; var StyledHeadingWrapper = styled.div.withConfig({ displayName: "CardHeader__StyledHeadingWrapper", componentId: "sc-4ssel7-1" })(["display:flex;align-items:center;", "{width:100%;}"], StyledHeading); var StyledSubTitle = styled.div.withConfig({ displayName: "CardHeader__StyledSubTitle", componentId: "sc-4ssel7-2" })(["display:flex;margin-top:", ";"], function (_ref4) { var theme = _ref4.theme; return theme.orbit.spaceXXSmall; }); StyledSubTitle.defaultProps = { theme: defaultTheme }; var StyledIcon = styled.div.withConfig({ displayName: "CardHeader__StyledIcon", componentId: "sc-4ssel7-3" })(["color:", ";display:flex;align-items:center;margin:", ";"], function (_ref5) { var theme = _ref5.theme; return theme.orbit.colorHeading; }, function (_ref6) { var theme = _ref6.theme; return rtlSpacing("0 ".concat(theme.orbit.spaceSmall, " 0 0")); }); StyledIcon.defaultProps = { theme: defaultTheme }; var CardHeader = function CardHeader(_ref7) { var icon = _ref7.icon, title = _ref7.title, subTitle = _ref7.subTitle, actions = _ref7.actions, dataTest = _ref7.dataTest, dataA11ySection = _ref7.dataA11ySection; return /*#__PURE__*/React.createElement(StyledCardHeader, { "data-test": dataTest }, /*#__PURE__*/React.createElement(StyledHeadingWrapper, null, icon && /*#__PURE__*/React.createElement(StyledIcon, null, icon), /*#__PURE__*/React.createElement(Heading, { type: "title3", as: "h2", dataA11ySection: dataA11ySection }, title), actions), subTitle && /*#__PURE__*/React.createElement(StyledSubTitle, null, /*#__PURE__*/React.createElement(Text, null, subTitle))); }; CardHeader.displayName = "CardHeader"; export default CardHeader;