Elffuss BraidHub

kikocis/continue public

main · 1.3 KiBRawPermalink
1import { PlusIcon } from "@heroicons/react/24/outline";
2import { ToolTip } from "../../../components/gui/Tooltip";
3import { Button } from "../../../components/ui";
4
5interface ConfigHeaderProps {
6 title: string;
7 subtext?: string;
8 onAddClick?: () => void;
9 addButtonTooltip?: string;
10 className?: string;
11 variant?: "default" | "sm";
12}
13
14export function ConfigHeader({
15 title,
16 subtext,
17 onAddClick,
18 addButtonTooltip = "Add item",
19 className = "",
20 variant = "default",
21}: ConfigHeaderProps) {
22 const isSmall = variant === "sm";
23 const marginBottom = isSmall ? "mb-4" : "mb-6";
24 const titleSize = isSmall ? "text-sm font-semibold" : "text-xl font-semibold";
25 const HeadingTag = isSmall ? "h3" : "h2";
26
27 return (
28 <div
29 className={`${marginBottom} flex items-center justify-between ${className}`}
30 >
31 <div className="flex flex-col">
32 <HeadingTag className={`my-0 ${titleSize}`}>{title}</HeadingTag>
33 {subtext && <p className="text-description mt-1 text-sm">{subtext}</p>}
34 </div>
35 {onAddClick && (
36 <ToolTip content={addButtonTooltip}>
37 <Button
38 onClick={onAddClick}
39 variant="icon"
40 size={isSmall ? "sm" : "lg"}
41 >
42 <PlusIcon className={isSmall ? "h-2.5 w-2.5" : "h-3 w-3"} />
43 </Button>
44 </ToolTip>
45 )}
46 </div>
47 );
48}