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.

30 lines 785 B
import React from "react"; import styled, { css } from "styled-components"; import { spacingUtility } from "../../../utils/common"; import { usePanel } from "../../TabContext"; const StyledPanel = styled.div.withConfig({ displayName: "TabPanel__StyledPanel", componentId: "sc-knf32i-0" })(["", ";"], ({ $margin, $padding }) => css(["", ";", ";"], spacingUtility($padding, "padding"), spacingUtility($margin))); const TabPanel = ({ children, margin, padding, dataTest, active = false }) => { const { index, isActive } = usePanel(); return active || isActive ? /*#__PURE__*/React.createElement(StyledPanel, { $margin: margin, $padding: padding, id: `panel-${index}`, "data-test": dataTest }, children) : null; }; export default TabPanel;