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.

42 lines 1.59 kB
import React from "react"; import styled, { css } from "styled-components"; import Button from "../../../Button"; import defaultTheme from "../../../defaultTheme"; const StyledWrapper = styled.div.withConfig({ displayName: "SectionHeader__StyledWrapper", componentId: "sc-562ymr-0" })(["", ";"], ({ theme, expanded }) => css(["display:flex;padding:", ";background-color:", ";align-items:center;min-height:", ";transition:max-height ", " ease-in-out;"], theme.orbit.spaceLarge, theme.orbit.paletteWhite, expanded ? "19px" : "44px", theme.orbit.durationFast)); StyledWrapper.defaultProps = { theme: defaultTheme }; const HeaderContent = styled.div.withConfig({ displayName: "SectionHeader__HeaderContent", componentId: "sc-562ymr-1" })(["display:flex;flex-grow:1;align-items:center;"]); const HeaderActions = styled.div.withConfig({ displayName: "SectionHeader__HeaderActions", componentId: "sc-562ymr-2" })(["display:flex;margin-left:", ";"], ({ theme }) => theme.orbit.spaceLarge); HeaderActions.defaultProps = { theme: defaultTheme }; const AccordionSectionHeader = ({ children, actions, expanded, onExpand, expandable, dataTest }) => /*#__PURE__*/React.createElement(StyledWrapper, { expanded: expanded, "data-test": dataTest && `${dataTest}Header` }, /*#__PURE__*/React.createElement(HeaderContent, null, children), !expanded && /*#__PURE__*/React.createElement(HeaderActions, null, expandable && (actions || /*#__PURE__*/React.createElement(Button, { onClick: onExpand, type: "secondary" }, "Open")))); export default AccordionSectionHeader;