@chayns-components/core
Version:
A set of beautiful React components for developing your own applications with chayns.
23 lines • 708 B
JavaScript
import { AnimatePresence } from 'motion/react';
import React, { useMemo } from 'react';
import { StyledMotionExpandableContent } from './ExpandableContent.styles';
const ExpandableContent = _ref => {
let {
children,
isOpen
} = _ref;
return useMemo(() => /*#__PURE__*/React.createElement(AnimatePresence, {
initial: false
}, /*#__PURE__*/React.createElement(StyledMotionExpandableContent, {
animate: {
height: isOpen ? 'auto' : '0px'
},
transition: {
duration: 0.2,
type: 'tween'
}
}, children)), [children, isOpen]);
};
ExpandableContent.displayName = 'ExpandableContent';
export default ExpandableContent;
//# sourceMappingURL=ExpandableContent.js.map