2025-02-20 22:58:01 +05:30
|
|
|
import clsx from "clsx";
|
|
|
|
|
import { ActionButton } from "./structured-panel";
|
|
|
|
|
|
2025-03-19 00:17:06 +05:30
|
|
|
export function SectionHeader({ title, children }: { title: string; children: React.ReactNode }) {
|
2025-02-20 22:58:01 +05:30
|
|
|
return (
|
|
|
|
|
<div className="flex items-center justify-between px-2 py-1 mt-4 first:mt-0 border-b border-gray-200 dark:border-gray-600">
|
|
|
|
|
<div className="text-xs font-semibold text-gray-400 dark:text-gray-300 uppercase">{title}</div>
|
2025-03-19 00:17:06 +05:30
|
|
|
<div className="flex items-center gap-3">
|
|
|
|
|
{children}
|
|
|
|
|
</div>
|
2025-02-20 22:58:01 +05:30
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-19 00:17:06 +05:30
|
|
|
export function ListItem({
|
|
|
|
|
name,
|
|
|
|
|
isSelected,
|
|
|
|
|
onClick,
|
2025-02-20 22:58:01 +05:30
|
|
|
disabled,
|
|
|
|
|
rightElement,
|
2025-03-15 02:51:24 +05:30
|
|
|
selectedRef,
|
|
|
|
|
icon
|
2025-03-19 00:17:06 +05:30
|
|
|
}: {
|
2025-02-20 22:58:01 +05:30
|
|
|
name: string;
|
|
|
|
|
isSelected: boolean;
|
|
|
|
|
onClick: () => void;
|
|
|
|
|
disabled?: boolean;
|
|
|
|
|
rightElement?: React.ReactNode;
|
2025-06-24 12:07:30 +05:30
|
|
|
selectedRef?: React.RefObject<HTMLButtonElement | null>;
|
2025-03-15 02:51:24 +05:30
|
|
|
icon?: React.ReactNode;
|
2025-02-20 22:58:01 +05:30
|
|
|
}) {
|
|
|
|
|
return (
|
|
|
|
|
<button
|
|
|
|
|
ref={selectedRef as any}
|
|
|
|
|
onClick={onClick}
|
|
|
|
|
className={clsx("flex items-center justify-between rounded-md px-2 py-1", {
|
|
|
|
|
"bg-gray-100 dark:bg-gray-700": isSelected,
|
|
|
|
|
"hover:bg-gray-50 dark:hover:bg-gray-800": !isSelected,
|
|
|
|
|
})}
|
|
|
|
|
>
|
2025-03-15 02:51:24 +05:30
|
|
|
<div className="flex items-center gap-1">
|
|
|
|
|
{icon && <div className="w-4 shrink-0">{icon}</div>}
|
|
|
|
|
<div className={clsx("truncate text-sm dark:text-gray-200", {
|
|
|
|
|
"text-gray-400 dark:text-gray-500": disabled,
|
|
|
|
|
})}>{name}</div>
|
|
|
|
|
</div>
|
2025-02-20 22:58:01 +05:30
|
|
|
{rightElement}
|
|
|
|
|
</button>
|
|
|
|
|
);
|
|
|
|
|
}
|