Elffuss BraidHub

kikocis/continue public

make edit container collapsible
Changesetc850f17d743975f4a83c1b5a175e9c983ea0b63c729ae18fe4978b51e032d180
AuthorNate <sestinj@gmail.com> · 2025-07-04 22:19 -07:00
CommitterNate <sestinj@gmail.com> · 2025-07-04 22:19 -07:00
Parentsf93f67ceefea

Browse the files at this changeset

2 files changed

added gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/CollapsibleContainer.tsx +48 −0
@@ -0,0 +1,48 @@
1+import { ChevronDownIcon } from "@heroicons/react/24/outline";
2+import { useState } from "react";
3+
4+interface CollapsibleContainerProps {
5+ children: React.ReactNode;
6+ maxHeight?: string;
7+ className?: string;
8+}
9+
10+export function CollapsibleContainer({
11+ children,
12+ maxHeight = "max-h-40",
13+ className = "",
14+}: CollapsibleContainerProps) {
15+ const [isExpanded, setIsExpanded] = useState(false);
16+
17+ return (
18+ <div className={`relative ${className}`}>
19+ <div className={`overflow-hidden ${isExpanded ? "" : maxHeight}`}>
20+ {children}
21+ </div>
22+
23+ {!isExpanded && (
24+ <div className="from-editor absolute bottom-0 left-0 right-0 h-12 bg-gradient-to-t to-transparent">
25+ <div
26+ onClick={() => setIsExpanded(true)}
27+ className="flex h-full cursor-pointer items-end justify-center pb-2"
28+ >
29+ <span title="Expand to show full content">
30+ <ChevronDownIcon className="text-lightgray h-4 w-4" />
31+ </span>
32+ </div>
33+ </div>
34+ )}
35+
36+ {isExpanded && (
37+ <div
38+ onClick={() => setIsExpanded(false)}
39+ className="mt-2 flex cursor-pointer justify-center"
40+ >
41+ <span title="Collapse to compact view">
42+ <ChevronDownIcon className="text-lightgray h-4 w-4 rotate-180" />
43+ </span>
44+ </div>
45+ )}
46+ </div>
47+ );
48+}
modified gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/index.tsx +2 −3
@@ -13,6 +13,7 @@
1313 import Spinner from "../../gui/Spinner";
1414 import { isTerminalCodeBlock } from "../utils";
1515 import { ApplyActions } from "./ApplyActions";
16+import { CollapsibleContainer } from "./CollapsibleContainer";
1617 import { CopyButton } from "./CopyButton";
1718 import { CreateFileButton } from "./CreateFileButton";
1819 import { FileInfo } from "./FileInfo";
@@ -299,9 +300,7 @@
299300 </div>
300301 </div>
301302
302- {isExpanded && (
303- <div className="overflow-hidden overflow-y-auto">{children}</div>
304- )}
303+ {isExpanded && <CollapsibleContainer>{children}</CollapsibleContainer>}
305304 </div>
306305 );
307306 }