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.

35 lines 1.53 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import styled, { css } from "styled-components"; import React from "react"; import defaultTheme from "../../../defaultTheme"; import mq from "../../../utils/mediaQuery"; export const getBorder = ({ theme }) => `${theme.orbit.borderWidthCard} ${theme.orbit.borderStyleCard} ${theme.orbit.borderColorCard}`; export const getBorderRadius = ({ theme }) => `${theme.orbit.borderRadiusNormal}`; const CardElement = css(["", ";"], ({ theme, expanded }) => css(["width:100%;box-sizing:border-box;position:relative;box-shadow:", ";border-top:", ";background:", ";", ";"], expanded && theme.orbit.boxShadowActionActive, !expanded && getBorder, theme.orbit.backgroundCard, mq.largeMobile(css(["border-left:", ";border-right:", ";"], !expanded && getBorder, !expanded && getBorder)))); const StyledAccordionWrapper = styled.div.withConfig({ displayName: "AccordionWrapper__StyledAccordionWrapper", componentId: "sc-kupav0-0" })(["", ";border:", ";border-radius:", ";transition:margin ", " ease-in-out;margin:", " 0;"], CardElement, getBorder, getBorderRadius, ({ theme }) => theme.orbit.durationFast, ({ theme }) => theme.orbit.spaceXSmall); StyledAccordionWrapper.defaultProps = { theme: defaultTheme }; const AccordionWrapper = ({ dataTest, initialExpanded, ...props }) => /*#__PURE__*/React.createElement(StyledAccordionWrapper, _extends({}, props, { expanded: props.expanded || initialExpanded, "data-test": dataTest })); export default AccordionWrapper;