import React from 'react';

interface DocumentsGridContainerProps {
    children: React.ReactNode;
    clearSelection: () => void;
    gridIconSize?: number;
    [key: string]: any;
}

const DocumentsGridContainer: React.FC<DocumentsGridContainerProps> = ({
    children,
    clearSelection,
    gridIconSize,
    ...props
}) => {
    return (
        <div
            className="documents-grid"
            role="list"
            {...props}
            style={
                gridIconSize
                    ? ({ '--documents-grid-icon-size': `${gridIconSize}px` } as React.CSSProperties)
                    : undefined
            }
            onClick={(event) => {
                if (event.target === event.currentTarget) {
                    clearSelection();
                }
            }}
        >
            {children}
        </div>
    );
};

export default DocumentsGridContainer;
