mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-10-13 19:19:49 +02:00

* crowfoot many * crowfoot one * one or many * add icons for crowfoot * add crowfoot icons * adjust arrowhead selection popover * make options collapsible * swap triangle and bar * switch to radix popover * put triangle outline in the first row * align shadow with new design spec * remove unused flag * swap order * tweak labels * handle shift+tab --------- Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com> Co-authored-by: Jakub Królak <108676707+j-krolak@users.noreply.github.com>
47 lines
1.0 KiB
TypeScript
47 lines
1.0 KiB
TypeScript
import { InlineIcon } from "../InlineIcon";
|
|
import { collapseDownIcon, collapseUpIcon } from "../icons";
|
|
|
|
interface CollapsibleProps {
|
|
label: React.ReactNode;
|
|
// having it controlled so that the state is managed outside
|
|
// this is to keep the user's previous choice even when the
|
|
// Collapsible is unmounted
|
|
open: boolean;
|
|
openTrigger: () => void;
|
|
children: React.ReactNode;
|
|
className?: string;
|
|
}
|
|
|
|
const Collapsible = ({
|
|
label,
|
|
open,
|
|
openTrigger,
|
|
children,
|
|
className,
|
|
}: CollapsibleProps) => {
|
|
return (
|
|
<>
|
|
<div
|
|
style={{
|
|
cursor: "pointer",
|
|
display: "flex",
|
|
justifyContent: "space-between",
|
|
alignItems: "center",
|
|
}}
|
|
className={className}
|
|
onClick={openTrigger}
|
|
>
|
|
{label}
|
|
<InlineIcon icon={open ? collapseUpIcon : collapseDownIcon} />
|
|
</div>
|
|
{open && (
|
|
<div style={{ display: "flex", flexDirection: "column" }}>
|
|
{children}
|
|
</div>
|
|
)}
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default Collapsible;
|