fix: improve not found label

This commit is contained in:
Alex Varchuk 2021-10-11 16:43:07 +03:00
parent 625f68ae30
commit 86b87d93ac
3 changed files with 7 additions and 3 deletions

View File

@ -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');
})
});

View File

@ -16,6 +16,7 @@ import {
SearchResultsBox,
SearchWrap,
} from './styled.elements';
import { l } from '../../services/Labels';
export interface SearchBoxProps {
search: SearchStore<string>;
@ -171,8 +172,9 @@ export class SearchBox extends React.PureComponent<SearchBoxProps, SearchBoxStat
</SearchResultsBox>
</PerfectScrollbarWrap>
)}
{(this.state.term) && this.state.noResults ? <SearchResultsBox data-role="search:results">No results found!</SearchResultsBox> : null
}
{this.state.term && this.state.noResults ? (
<SearchResultsBox data-role="search:results">{l('noResultsFound')}</SearchResultsBox>
) : null}
</SearchWrap>
);
}

View File

@ -10,6 +10,7 @@ export interface LabelsConfig {
arrayOf: string;
webhook: string;
const: string;
noResultsFound: string;
}
export type LabelsConfigRaw = Partial<LabelsConfig>;
@ -26,6 +27,7 @@ const labels: LabelsConfig = {
arrayOf: 'Array of ',
webhook: 'Event',
const: 'Value',
noResultsFound: 'No results found',
};
export function setRedocLabels(_labels?: LabelsConfigRaw) {