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.

78 lines (76 loc) 2.32 kB
import React from "react"; import styled, { css } from "styled-components"; import mq from "../../../utils/mediaQuery"; import { getSize } from "../../../Icon"; import { ICON_SIZES } from "../../../Icon/consts"; import defaultTheme from "../../../defaultTheme"; import Header from "../../components/Header"; const SpacingMobile = css(["", "px;"], ({ theme }) => String(parseInt(theme.orbit.spaceMedium, 10) + 1)); const SpacingDesktop = css(["", "px;"], ({ theme }) => String(parseInt(theme.orbit.spaceLarge, 10) + 1)); const StyledCardSectionHeader = styled.div.withConfig({ displayName: "SectionHeader__StyledCardSectionHeader", componentId: "sc-1win3x-0" })(["transition:margin ", " linear;cursor:", ";position:relative;padding:", ";margin:-", ";margin-bottom:", ";min-height:", ";", " &:hover{background:", ";}&:focus{background:", ";outline:none;}"], ({ theme }) => theme.orbit.durationFast, ({ expandable }) => expandable && "pointer", ({ theme }) => theme.orbit.spaceMedium, SpacingMobile, ({ expanded }) => expanded && 0, ({ expandable }) => expandable && getSize(ICON_SIZES.MEDIUM), mq.tablet(css(["margin:-", ";padding:", ";margin-bottom:", ";"], SpacingDesktop, ({ theme }) => theme.orbit.spaceLarge, ({ expanded }) => expanded && 0)), ({ theme, expandable }) => expandable && theme.orbit.paletteWhiteHover, ({ theme, expandable }) => expandable && theme.orbit.paletteWhiteHover); StyledCardSectionHeader.defaultProps = { theme: defaultTheme }; const CardSectionHeader = ({ title, description, icon, expandable, expanded, onClick, slideID, labelID, actions, handleKeyDown, header, dataA11ySection }) => { return React.createElement(StyledCardSectionHeader, { expandable: expandable, expanded: expanded, onClick: onClick, "aria-expanded": expandable ? expanded : undefined, "aria-controls": expandable ? slideID : undefined, id: labelID, role: expandable ? "button" : undefined, onKeyDown: handleKeyDown, tabIndex: expandable ? "0" : undefined }, React.createElement(Header, { title: title, description: description, icon: icon, expandable: expandable, header: header, expanded: expanded, actions: actions, dataA11ySection: dataA11ySection })); }; export default CardSectionHeader;