@sky-mavis/tanto-widget
Version:
Tanto Widget
22 lines • 502 B
JavaScript
import {jsx}from'@emotion/react/jsx-runtime';import useResizeObserver from'use-resize-observer';const SmoothHeight = ({
children,
...rest
}) => {
const {
height,
ref
} = useResizeObserver();
return jsx("div", {
style: {
boxSizing: 'border-box',
overflow: 'hidden',
transition: 'height 0.2s',
height: height ? `${height}px` : 'auto'
},
...rest,
children: jsx("div", {
ref: ref,
children: children
})
});
};export{SmoothHeight};