@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.
63 lines • 2.2 kB
JavaScript
import * as React from "react";
import styled, { css } from "styled-components";
import transition from "../../../utils/transition";
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 StyledCardSectionHeader = styled.div.withConfig({
displayName: "SectionHeader__StyledCardSectionHeader",
componentId: "sc-qagprz-0"
})(["", ""], ({
theme,
expandable,
isContent,
expanded
}) => css(["transition:", ";cursor:", ";position:relative;padding:", ";margin:-", "px;margin-bottom:", ";min-height:", ";", " &:hover{background:", ";}"], transition(["margin"], "fast", "linear"), expandable && "pointer", theme.orbit.spaceMedium, parseInt(theme.orbit.spaceMedium, 10) + 1, expanded && isContent && 0, expandable && getSize(ICON_SIZES.MEDIUM), mq.largeMobile(css(["margin:-", "px;padding:", ";margin-bottom:", ";"], parseInt(theme.orbit.spaceLarge, 10) + 1, theme.orbit.spaceLarge, expanded && isContent && 0)), expandable && theme.orbit.paletteWhiteHover));
StyledCardSectionHeader.defaultProps = {
theme: defaultTheme
};
const CardSectionHeader = ({
title,
titleAs,
description,
icon,
isContent,
expandable,
expanded,
labelClose,
onClick,
slideID,
labelID,
actions,
handleKeyDown,
header,
dataA11ySection
}) => {
return /*#__PURE__*/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,
isContent: isContent
}, /*#__PURE__*/React.createElement(Header, {
title: title,
titleAs: titleAs,
description: description,
labelClose: labelClose,
icon: icon,
expandable: expandable,
header: header,
expanded: expanded,
actions: actions,
isSection: true,
dataA11ySection: dataA11ySection
}));
};
export default CardSectionHeader;