diff --git a/.prettierrc.json b/.prettierrc.json
index 5ad0627..8bfa5a7 100644
--- a/.prettierrc.json
+++ b/.prettierrc.json
@@ -1,7 +1,7 @@
{
"singleQuote": true,
"jsxSingleQuote": true,
- "printWidth": 300,
+ "printWidth": 120,
"semi": false,
"endOfLine": "auto"
}
\ No newline at end of file
diff --git a/components/AllResultsView/AllResultsView.tsx b/components/AllResultsView/AllResultsView.tsx
index db1075f..fa53651 100644
--- a/components/AllResultsView/AllResultsView.tsx
+++ b/components/AllResultsView/AllResultsView.tsx
@@ -41,11 +41,10 @@ type organicItemsObj = {
pixelUrl: string
}
interface Prop {
- organicResults: { items: organicItemsObj[] }
- sponsoredResults: { items: sponsoredItemsObj[] }
- relatedSearches: { items: relatedLinks[] }
- imageResults: { items: image[] }
- videoResults: { items: any[] }
+ organicItems: organicItemsObj[]
+ sponsoredItems: sponsoredItemsObj[]
+ relatedSearches: relatedLinks[]
+ imagesItems: image[]
batches?: { [x: number]: any[] }
}
@@ -70,10 +69,7 @@ const AllResultsView = ({ results, searchQuery }: ResultsProp) => {
if (!results) return <>>
- const { organicResults, sponsoredResults, relatedSearches, imageResults, batches } = results
- const organicItems = organicResults.items
- const sponsoredItems = sponsoredResults.items
- const images = imageResults.items
+ const { organicItems, sponsoredItems, relatedSearches, imagesItems, batches } = results
const mainlineSponsor = []
const sidebarSponsor = []
@@ -83,7 +79,7 @@ const AllResultsView = ({ results, searchQuery }: ResultsProp) => {
}
const firstBatchOrganic = !organicItems.length ? [] : organicItems.slice(0, 3)
const secondBatchOrganic = !organicItems.length ? [] : organicItems.slice(3, organicItems.length)
- const combinedResults = [...mainlineSponsor, ...firstBatchOrganic, images, ...secondBatchOrganic]
+ const combinedResults = [...mainlineSponsor, ...firstBatchOrganic, imagesItems, ...secondBatchOrganic]
return (
<>
@@ -91,9 +87,9 @@ const AllResultsView = ({ results, searchQuery }: ResultsProp) => {
{t('search:no_result_found_query', { query: searchQuery })}
) : (
- {relatedSearches.items.length !== 0 && (
+ {relatedSearches.length !== 0 && (
-
+
)}
@@ -108,9 +104,9 @@ const AllResultsView = ({ results, searchQuery }: ResultsProp) => {
}
})}
- {relatedSearches.items.length !== 0 && (
+ {relatedSearches.length !== 0 && (
-
+
)}
diff --git a/components/ImagesView/ImagesView.tsx b/components/ImagesView/ImagesView.tsx
index 8b966c0..3b89df6 100644
--- a/components/ImagesView/ImagesView.tsx
+++ b/components/ImagesView/ImagesView.tsx
@@ -8,22 +8,16 @@ type ImagesProp = {
imageUrl: string
thumbnailUrl: string
pixelUrl: string
+ length: () => number
+ map: any
}
-
-interface Prop {
- imageResults: { items: ImagesProp[] }
-}
-
interface ResultsProp {
- results: Prop
+ images: ImagesProp
query: string
}
-const ImagesView = ({ results, query }: ResultsProp) => {
+const ImagesView = ({ images, query }: ResultsProp) => {
const { t } = useTranslation()
- if (!results) return <>>
-
- const images = results.imageResults.items
return (
<>
diff --git a/components/NewsView/NewsView.tsx b/components/NewsView/NewsView.tsx
index 793a3d8..5adf9b7 100644
--- a/components/NewsView/NewsView.tsx
+++ b/components/NewsView/NewsView.tsx
@@ -11,20 +11,16 @@ type NewsObj = {
provider: string
description: string
pixelUrl: string
+ length: () => number
+ map: any
}
-
-interface Prop {
- newsResults: { items: NewsObj[] }
-}
-
interface ResultsProp {
- results: Prop
+ news: NewsObj
query: string
}
-const NewsView = ({ results, query }: ResultsProp) => {
+const NewsView = ({ news, query }: ResultsProp) => {
const { t } = useTranslation()
- const news = results.newsResults?.items
return (
<>
diff --git a/components/SearchBar/SearchBar.tsx b/components/SearchBar/SearchBar.tsx
index 89323fc..2ff35b7 100644
--- a/components/SearchBar/SearchBar.tsx
+++ b/components/SearchBar/SearchBar.tsx
@@ -38,7 +38,7 @@ const SearchBar = ({ big }: SearchProps) => {
openInNewTab: userState.openInNewTab,
},
})
- const { register } = methods
+ const { handleSubmit, register } = methods
if (type !== typeValue && typeValue !== initType) {
setTypeValue(type)
@@ -113,6 +113,11 @@ const SearchBar = ({ big }: SearchProps) => {
}
}, [searchValue])
+ function onSubmit({ q }) {
+ setSearchValue(q)
+ search()
+ }
+
function resetDropdown(event) {
setIsSuggestionOpen(false)
setHighlightIndex(null)
@@ -148,7 +153,7 @@ const SearchBar = ({ big }: SearchProps) => {
return (