* fix frame name clipping on zooming * include assistant font * default frame name * extend search to frame names * add a simple test * collpase search match items * id check out of loop * fix frame name check * include focusedId for small perf improvement * optionally show and hide collapse icon * update section title * fix tests * rename `serverSide` -> `private` * revert: do not reset zoom on zoom change * feat: do not close menu on repeated ctrl+f * remove collapsible * tweak results CSS * remove redundant check * set `appState.searchMatches` to null if empty --------- Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
51 lines
1.1 KiB
TypeScript
51 lines
1.1 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;
|
|
showCollapsedIcon?: boolean;
|
|
}
|
|
|
|
const Collapsible = ({
|
|
label,
|
|
open,
|
|
openTrigger,
|
|
children,
|
|
className,
|
|
showCollapsedIcon = true,
|
|
}: CollapsibleProps) => {
|
|
return (
|
|
<>
|
|
<div
|
|
style={{
|
|
cursor: "pointer",
|
|
display: "flex",
|
|
justifyContent: "space-between",
|
|
alignItems: "center",
|
|
}}
|
|
className={className}
|
|
onClick={openTrigger}
|
|
>
|
|
{label}
|
|
{showCollapsedIcon && (
|
|
<InlineIcon icon={open ? collapseUpIcon : collapseDownIcon} />
|
|
)}
|
|
</div>
|
|
{open && (
|
|
<div style={{ display: "flex", flexDirection: "column" }}>
|
|
{children}
|
|
</div>
|
|
)}
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default Collapsible;
|