From c8b6d52f9a7ce65f89b55cff8cacc03d1aafd6f2 Mon Sep 17 00:00:00 2001 From: Lukasz Ostafin Date: Thu, 21 Nov 2024 11:29:52 +0100 Subject: [PATCH] After CR --- .../public/js/scripts/admin.search.js | 21 ------------------- .../Resources/public/ts/admin.search.ts | 4 ++-- .../modules/common/thumbnail/thumbnail.tsx | 10 +-------- .../common/thumbnail/thumbnail.types.ts | 6 ++++++ .../src/modules/common/types/common.d.ts | 6 ++++++ 5 files changed, 15 insertions(+), 32 deletions(-) delete mode 100644 src/bundle/Resources/public/js/scripts/admin.search.js create mode 100644 src/bundle/ui-dev/src/modules/common/thumbnail/thumbnail.types.ts create mode 100644 src/bundle/ui-dev/src/modules/common/types/common.d.ts diff --git a/src/bundle/Resources/public/js/scripts/admin.search.js b/src/bundle/Resources/public/js/scripts/admin.search.js deleted file mode 100644 index c9f05d7917..0000000000 --- a/src/bundle/Resources/public/js/scripts/admin.search.js +++ /dev/null @@ -1,21 +0,0 @@ -(function (global, doc) { - const headerSearchInput = doc.querySelector('.ibexa-global-search__input'); - const headerSearchSubmitBtn = doc.querySelector('.ibexa-main-header .ibexa-input-text-wrapper__action-btn--search'); - const searchForm = doc.querySelector('.ibexa-search-form'); - const searchInput = doc.querySelector('.ibexa-search-form__search-input'); - const languageSelector = doc.querySelector('.ibexa-filters__item--language-selector .ibexa-filters__select'); - const submitForm = () => { - searchInput.value = headerSearchInput.value; - searchForm.submit(); - }; - const handleHeaderSearchBtnClick = (event) => { - event.preventDefault(); - - submitForm(); - }; - - headerSearchInput.value = searchInput.value; - - headerSearchSubmitBtn.addEventListener('click', handleHeaderSearchBtnClick, false); - languageSelector?.addEventListener('change', submitForm, false); -})(window, document); diff --git a/src/bundle/Resources/public/ts/admin.search.ts b/src/bundle/Resources/public/ts/admin.search.ts index f8227b0729..52b7f673ec 100644 --- a/src/bundle/Resources/public/ts/admin.search.ts +++ b/src/bundle/Resources/public/ts/admin.search.ts @@ -1,4 +1,4 @@ -(function (document: Document) { +(function () { const searchForm = document.querySelector('.ibexa-search-form'); const searchInput = document.querySelector('.ibexa-search-form__search-input'); const headerSearchInput = document.querySelector('.ibexa-global-search__input'); @@ -25,4 +25,4 @@ headerSearchSubmitBtn?.addEventListener('click', handleHeaderSearchBtnClick, false); languageSelector?.addEventListener('change', submitForm, false); -})(document); +})(); diff --git a/src/bundle/ui-dev/src/modules/common/thumbnail/thumbnail.tsx b/src/bundle/ui-dev/src/modules/common/thumbnail/thumbnail.tsx index 106d2588e7..0df36f7347 100644 --- a/src/bundle/ui-dev/src/modules/common/thumbnail/thumbnail.tsx +++ b/src/bundle/ui-dev/src/modules/common/thumbnail/thumbnail.tsx @@ -1,14 +1,6 @@ import React from 'react'; import Icon from '../icon/icon'; - -interface ThumbnailProps { - thumbnailData: { - mimeType: string; - resource: string; - }; - iconExtraClasses?: string; - contentTypeIconPath?: string; -} +import ThumbnailProps from './thumbnail.types'; const Thumbnail = ({ thumbnailData, iconExtraClasses, contentTypeIconPath }: ThumbnailProps) => { const renderContentTypeIcon = (): JSX.Element | null => { diff --git a/src/bundle/ui-dev/src/modules/common/thumbnail/thumbnail.types.ts b/src/bundle/ui-dev/src/modules/common/thumbnail/thumbnail.types.ts new file mode 100644 index 0000000000..bf82c07682 --- /dev/null +++ b/src/bundle/ui-dev/src/modules/common/thumbnail/thumbnail.types.ts @@ -0,0 +1,6 @@ +import { thumbnailData } from '../types/common'; + +export default interface ThumbnailProps extends thumbnailData { + iconExtraClasses?: string; + contentTypeIconPath?: string; +}; diff --git a/src/bundle/ui-dev/src/modules/common/types/common.d.ts b/src/bundle/ui-dev/src/modules/common/types/common.d.ts new file mode 100644 index 0000000000..dabda8efbd --- /dev/null +++ b/src/bundle/ui-dev/src/modules/common/types/common.d.ts @@ -0,0 +1,6 @@ +export interface thumbnailData { + thumbnailData: { + mimeType: string; + resource: string; + } +}