@kadoui/react
Version:
Kadoui primitive components for React
20 lines (19 loc) • 767 B
JavaScript
"use client";
import { jsx as _jsx } from "react/jsx-runtime";
import { use } from "react";
import { ShowMoreContext } from "./ShowMoreContext";
export function ShowMoreContent({ children, style, ...props }) {
const { contentRef, shouldShowMore, isShowMore, maxHeight } = use(ShowMoreContext);
return (_jsx("div", { ref: contentRef, style: {
overflow: "hidden",
transition: "all 150ms ease",
height: shouldShowMore
? isShowMore
? contentRef.current?.scrollHeight
? `${contentRef.current.scrollHeight}px`
: "auto"
: maxHeight
: "auto",
...style
}, ...props, children: children }));
}