Skip to content

Commit 8d4558a

Browse files
bhbslayershifter
andauthored
fix(Search): type definition for layout renderer (#4309)
* fix(Search): type definition for layout renderer * Apply suggestions from code review Co-authored-by: Oleksandr Fediashov <[email protected]>
1 parent a8b5daf commit 8d4558a

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

src/modules/Search/Search.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { InputProps } from '../../elements/Input'
55
import SearchCategory, { SearchCategoryProps } from './SearchCategory'
66
import SearchResult, { SearchResultProps } from './SearchResult'
77
import SearchResults from './SearchResults'
8+
import { SearchCategoryLayoutProps } from './SearchCategoryLayout'
89

910
export interface SearchProps extends StrictSearchProps {
1011
[key: string]: any
@@ -61,11 +62,10 @@ export interface StrictSearchProps {
6162
/**
6263
* Renders the SearchCategory layout.
6364
*
64-
* @param {object} categoryContent - The Renderable SearchCategory contents.
65-
* @param {object} resultsContent - The Renderable SearchResult contents.
65+
* @param {object} props - The SearchCategoryLayout props object.
6666
* @returns {*} - Renderable SearchCategory layout.
6767
*/
68-
categoryLayoutRenderer?: (props: SearchCategoryProps) => React.ReactElement<any>
68+
categoryLayoutRenderer?: (props: Pick<SearchCategoryLayoutProps, 'categoryContent' | 'resultsContent'>) => React.ReactElement<any>
6969

7070
/**
7171
* Renders the SearchCategory contents.

src/modules/Search/SearchCategory.d.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as React from 'react'
22

33
import { SemanticShorthandContent } from '../../generic'
4+
import { SearchCategoryLayoutProps } from './SearchCategoryLayout'
45
import SearchResult from './SearchResult'
56

67
export interface SearchCategoryProps extends StrictSearchCategoryProps {
@@ -29,14 +30,10 @@ export interface StrictSearchCategoryProps {
2930
/**
3031
* Renders the SearchCategory layout.
3132
*
32-
* @param {object} categoryContent - The Renderable SearchCategory contents.
33-
* @param {object} resultsContent - The Renderable SearchResult contents.
33+
* @param {object} props - The SearchCategoryLayout props object.
3434
* @returns {*} - Renderable SearchCategory layout.
3535
*/
36-
layoutRenderer?: (
37-
categoryContent: React.ReactElement<any>,
38-
resultsContent: React.ReactElement<any>,
39-
) => React.ReactElement<any>
36+
layoutRenderer?: (props: Pick<SearchCategoryLayoutProps, 'categoryContent' | 'resultsContent'>) => React.ReactElement<any>
4037

4138
/**
4239
* Renders the category contents.

0 commit comments

Comments
 (0)