Skip to content

Commit

Permalink
Add limit info to search result text.
Browse files Browse the repository at this point in the history
  • Loading branch information
tusmester committed Jan 4, 2024
1 parent e194979 commit b2df7ac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion apps/sensenet/src/components/search/search-results.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ export const SearchResults = () => {
const snRoute = useSnRoute()

const searchState = useSearch()
const maxResultCount = 20

const resultText =
localization.resultCount(searchState.resultCount) +
(searchState.resultCount > maxResultCount ? ` ${localization.resultLimited(maxResultCount)}` : '')

return (
<>
Expand All @@ -36,7 +41,7 @@ export const SearchResults = () => {

{searchState.isLoading && <LinearProgress style={{ margin: '15px 15px 0' }} />}

<Typography style={{ margin: '1rem' }}>{localization.resultCount(searchState.resultCount)}</Typography>
<Typography style={{ margin: '1rem' }}>{resultText}</Typography>

<CurrentContentContext.Provider value={ConstantContent.PORTAL_ROOT}>
<CurrentChildrenContext.Provider value={searchState.result}>
Expand Down
1 change: 1 addition & 0 deletions apps/sensenet/src/localization/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ const values = {
queryHelperText: 'Enter a keyword',
clearTerm: 'Clear input',
resultCount: (count: number) => `${count} results`,
resultLimited: (limit: number) => `(only the first ${limit} are displayed)`,
openInSearchTitle: (term: string) => `See all results for '${term}'`,
openInSearchDescription: 'Opens the query expression in the Search view',
saveQuery: 'Save Query',
Expand Down

0 comments on commit b2df7ac

Please sign in to comment.