Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add limit info to search result text. #1588

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading