mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-31 04:59:24 +08:00
29 lines
827 B
TypeScript
29 lines
827 B
TypeScript
|
|
import {
|
||
|
|
Collapsible,
|
||
|
|
CollapsibleContent,
|
||
|
|
CollapsibleTrigger,
|
||
|
|
} from '@/components/ui/collapsible';
|
||
|
|
import { ListCollapse } from 'lucide-react';
|
||
|
|
import { PropsWithChildren, ReactNode } from 'react';
|
||
|
|
|
||
|
|
type CollapseProps = {
|
||
|
|
title?: ReactNode;
|
||
|
|
rightContent?: ReactNode;
|
||
|
|
} & PropsWithChildren;
|
||
|
|
|
||
|
|
export function Collapse({ title, children, rightContent }: CollapseProps) {
|
||
|
|
return (
|
||
|
|
<Collapsible defaultOpen>
|
||
|
|
<CollapsibleTrigger className="w-full">
|
||
|
|
<section className="flex justify-between items-center pb-2">
|
||
|
|
<div className="flex items-center gap-1">
|
||
|
|
<ListCollapse className="size-4" /> {title}
|
||
|
|
</div>
|
||
|
|
<div>{rightContent}</div>
|
||
|
|
</section>
|
||
|
|
</CollapsibleTrigger>
|
||
|
|
<CollapsibleContent>{children}</CollapsibleContent>
|
||
|
|
</Collapsible>
|
||
|
|
);
|
||
|
|
}
|