UNPKG

@helpwave/hightide

Version:

helpwave's component and theming library

35 lines 1.03 kB
// src/components/HideableContentSection.tsx import { useState } from "react"; import { ChevronDown, ChevronUp } from "lucide-react"; import clsx from "clsx"; import { jsx, jsxs } from "react/jsx-runtime"; var HideableContentSection = ({ initiallyOpen = true, disabled, children, header }) => { const [open, setOpen] = useState(initiallyOpen); return /* @__PURE__ */ jsxs("div", { className: "col", children: [ /* @__PURE__ */ jsxs( "div", { className: clsx("row justify-between items-center", { "cursor-pointer": !disabled }), onClick: () => { if (!disabled) { setOpen(!open); } }, children: [ /* @__PURE__ */ jsx("div", { children: header }), !disabled && (open ? /* @__PURE__ */ jsx(ChevronUp, {}) : /* @__PURE__ */ jsx(ChevronDown, {})) ] } ), open && /* @__PURE__ */ jsx("div", { children }) ] }); }; export { HideableContentSection }; //# sourceMappingURL=HideableContentSection.mjs.map