import React, { useCallback } from 'react';
import { GridCardItem } from './GridCardItem';
import { FolderIcon } from '../FolderIcon';
export function useRenderFolderItem(params) {
    const { state, folderPreset = 'title', renderFolderItem, dragAndDrop, folderActionCell, } = params;
    return useCallback((index, { itemKey: _itemKey, index2d } = {}) => {
        const renderType = state.getItemRenderTypeAt(index);
        if (renderType === null) {
            return null;
        }
        if (renderType === 'trailing') {
            return null;
        }
        let child = (React.createElement(GridCardItem, { state: state, index: index, rowIndex: index2d?.rowIndex, columnIndex: index2d?.columnIndex, keyedItem: renderType, renderItem: (item, i) => ({
                backgroundImageNode: React.createElement(FolderIcon, null),
                imagePlacement: 'side',
                ...renderFolderItem?.(item, i),
            }), preset: folderPreset, actionCell: folderActionCell }));
        if (dragAndDrop) {
            const { DraggableCard } = dragAndDrop;
            child = (React.createElement(DraggableCard, { id: renderType.key, index: renderType.index, state: state }, child));
        }
        return child;
    }, [dragAndDrop?.DraggableCard]);
}
//# sourceMappingURL=renderFolderItem.js.map