@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.
23 lines • 534 B
JavaScript
import * as React from "react";
import Slide from "../../../utils/Slide";
import useBoundingRect from "../../../hooks/useBoundingRect";
export default function Expandable({
expanded,
children,
slideID,
labelID
}) {
const [{
height
}, ref] = useBoundingRect({
height: expanded ? null : 0
});
return /*#__PURE__*/React.createElement(Slide, {
maxHeight: height,
expanded: expanded,
id: slideID,
ariaLabelledBy: labelID
}, /*#__PURE__*/React.createElement("div", {
ref: ref
}, children));
}