Skip to content

Commit

Permalink
fix(Search): type definition for layout renderer (#4309)
Browse files Browse the repository at this point in the history
* fix(Search): type definition for layout renderer

* Apply suggestions from code review

Co-authored-by: Oleksandr Fediashov <[email protected]>
  • Loading branch information
bhbs and layershifter authored Jan 14, 2022
1 parent a8b5daf commit 8d4558a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/modules/Search/Search.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { InputProps } from '../../elements/Input'
import SearchCategory, { SearchCategoryProps } from './SearchCategory'
import SearchResult, { SearchResultProps } from './SearchResult'
import SearchResults from './SearchResults'
import { SearchCategoryLayoutProps } from './SearchCategoryLayout'

export interface SearchProps extends StrictSearchProps {
[key: string]: any
Expand Down Expand Up @@ -61,11 +62,10 @@ export interface StrictSearchProps {
/**
* Renders the SearchCategory layout.
*
* @param {object} categoryContent - The Renderable SearchCategory contents.
* @param {object} resultsContent - The Renderable SearchResult contents.
* @param {object} props - The SearchCategoryLayout props object.
* @returns {*} - Renderable SearchCategory layout.
*/
categoryLayoutRenderer?: (props: SearchCategoryProps) => React.ReactElement<any>
categoryLayoutRenderer?: (props: Pick<SearchCategoryLayoutProps, 'categoryContent' | 'resultsContent'>) => React.ReactElement<any>

/**
* Renders the SearchCategory contents.
Expand Down
9 changes: 3 additions & 6 deletions src/modules/Search/SearchCategory.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react'

import { SemanticShorthandContent } from '../../generic'
import { SearchCategoryLayoutProps } from './SearchCategoryLayout'
import SearchResult from './SearchResult'

export interface SearchCategoryProps extends StrictSearchCategoryProps {
Expand Down Expand Up @@ -29,14 +30,10 @@ export interface StrictSearchCategoryProps {
/**
* Renders the SearchCategory layout.
*
* @param {object} categoryContent - The Renderable SearchCategory contents.
* @param {object} resultsContent - The Renderable SearchResult contents.
* @param {object} props - The SearchCategoryLayout props object.
* @returns {*} - Renderable SearchCategory layout.
*/
layoutRenderer?: (
categoryContent: React.ReactElement<any>,
resultsContent: React.ReactElement<any>,
) => React.ReactElement<any>
layoutRenderer?: (props: Pick<SearchCategoryLayoutProps, 'categoryContent' | 'resultsContent'>) => React.ReactElement<any>

/**
* Renders the category contents.
Expand Down

0 comments on commit 8d4558a

Please sign in to comment.