export default function SearchInfo({
                                       files, searchKeywordRef,
                                       setIsActive,
                                       setKeyword,
                                       setError,
                                       setIsSearchResults,
                                       setFiles,
                                       isActive,
                                       initFolders,
                                       allFiles,
                                   }) {

    const searchResults = files.length ? files.length : wp.i18n.__('No', 'integrate-google-drive');

    const infoMessage = wp.i18n.sprintf(
        wp.i18n.__('Search results for "%s": %s items found.', 'integrate-google-drive'),
        `<strong>${searchKeywordRef.current}</strong>`,
        searchResults
    );

    return (
        <div className="search-result-info">
            <span dangerouslySetInnerHTML={{__html: infoMessage}}/>

            <button
                onClick={(e) => {
                    setIsActive(!isActive);

                    setKeyword('');
                    setError(false);

                    setIsSearchResults(false);

                    setFiles(allFiles['']);
                }}
                className="clear-button igd-btn btn-warning">
                {wp.i18n.__('Clear', 'integrate-google-drive')}
            </button>
        </div>
    );
}