From a57395e11d8752104acea13abde5f762a7abd8d4 Mon Sep 17 00:00:00 2001 From: Alex Varchuk Date: Mon, 11 Oct 2021 15:42:07 +0300 Subject: [PATCH] fix: improve not found label --- e2e/integration/search.e2e.ts | 2 +- src/components/SearchBox/SearchBox.tsx | 6 ++++-- src/services/Labels.ts | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/e2e/integration/search.e2e.ts b/e2e/integration/search.e2e.ts index acdb428d..b1a7d4a7 100644 --- a/e2e/integration/search.e2e.ts +++ b/e2e/integration/search.e2e.ts @@ -57,6 +57,6 @@ describe('Search', () => { it('should show proper message when no search results are found', () => { getSearchResults().should('not.exist'); getSearchInput().type('xzss', {force: true}); - getSearchResults().should('exist').should('contain', 'No results found!'); + getSearchResults().should('exist').should('contain', 'No results found'); }) }); diff --git a/src/components/SearchBox/SearchBox.tsx b/src/components/SearchBox/SearchBox.tsx index b712487c..f0427eb8 100644 --- a/src/components/SearchBox/SearchBox.tsx +++ b/src/components/SearchBox/SearchBox.tsx @@ -16,6 +16,7 @@ import { SearchResultsBox, SearchWrap, } from './styled.elements'; +import { l } from '../../services/Labels'; export interface SearchBoxProps { search: SearchStore; @@ -171,8 +172,9 @@ export class SearchBox extends React.PureComponent )} - {(this.state.term) && this.state.noResults ? No results found! : null - } + {this.state.term && this.state.noResults ? ( + {l('noResultsFound')} + ) : null} ); } diff --git a/src/services/Labels.ts b/src/services/Labels.ts index 8e89bc2f..1b891372 100644 --- a/src/services/Labels.ts +++ b/src/services/Labels.ts @@ -10,6 +10,7 @@ export interface LabelsConfig { arrayOf: string; webhook: string; const: string; + noResultsFound: string; } export type LabelsConfigRaw = Partial; @@ -26,6 +27,7 @@ const labels: LabelsConfig = { arrayOf: 'Array of ', webhook: 'Event', const: 'Value', + noResultsFound: 'No results found', }; export function setRedocLabels(_labels?: LabelsConfigRaw) {