refactor: Decompose document and folder views into modular components and hooks, replacing monolithic list/grid implementations.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import React from 'react';
|
||||
import type { DocumentsViewProps } from '../panel/DocumentsPanel';
|
||||
import type { DocumentViewLogic } from '../hooks/useDocumentViewLogic';
|
||||
import { useDocumentItemLogic } from '../hooks/useDocumentItemLogic';
|
||||
import EntryShell from './EntryShell';
|
||||
|
||||
interface DocumentEntryProps extends DocumentsViewProps {
|
||||
doc: any;
|
||||
viewLogic: DocumentViewLogic;
|
||||
component: React.ElementType;
|
||||
className?: string;
|
||||
role?: string;
|
||||
children: (logic: ReturnType<typeof useDocumentItemLogic>) => React.ReactNode;
|
||||
}
|
||||
|
||||
const DocumentEntry: React.FC<DocumentEntryProps> = (props) => {
|
||||
const { doc, component, className, role, children, viewLogic } = props;
|
||||
const logic = useDocumentItemLogic({ doc, viewLogic, ...props });
|
||||
|
||||
return (
|
||||
<EntryShell
|
||||
component={component}
|
||||
id={`document-${doc.id}`}
|
||||
docId={doc.id}
|
||||
handlers={logic.handlers}
|
||||
isSelected={logic.isSelected}
|
||||
isDragging={logic.isDraggingDoc}
|
||||
canDrag={true}
|
||||
className={className}
|
||||
role={role}
|
||||
>
|
||||
{children(logic)}
|
||||
</EntryShell>
|
||||
);
|
||||
};
|
||||
|
||||
export default DocumentEntry;
|
||||
Reference in New Issue
Block a user