mirror of
https://github.com/Redocly/redoc.git
synced 2025-08-06 05:10:20 +03:00
fix: improve not found label
This commit is contained in:
parent
625f68ae30
commit
a57395e11d
|
@ -57,6 +57,6 @@ describe('Search', () => {
|
||||||
it('should show proper message when no search results are found', () => {
|
it('should show proper message when no search results are found', () => {
|
||||||
getSearchResults().should('not.exist');
|
getSearchResults().should('not.exist');
|
||||||
getSearchInput().type('xzss', {force: true});
|
getSearchInput().type('xzss', {force: true});
|
||||||
getSearchResults().should('exist').should('contain', 'No results found!');
|
getSearchResults().should('exist').should('contain', 'No results found');
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,6 +16,7 @@ import {
|
||||||
SearchResultsBox,
|
SearchResultsBox,
|
||||||
SearchWrap,
|
SearchWrap,
|
||||||
} from './styled.elements';
|
} from './styled.elements';
|
||||||
|
import { l } from '../../services/Labels';
|
||||||
|
|
||||||
export interface SearchBoxProps {
|
export interface SearchBoxProps {
|
||||||
search: SearchStore<string>;
|
search: SearchStore<string>;
|
||||||
|
@ -171,8 +172,9 @@ export class SearchBox extends React.PureComponent<SearchBoxProps, SearchBoxStat
|
||||||
</SearchResultsBox>
|
</SearchResultsBox>
|
||||||
</PerfectScrollbarWrap>
|
</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>
|
</SearchWrap>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ export interface LabelsConfig {
|
||||||
arrayOf: string;
|
arrayOf: string;
|
||||||
webhook: string;
|
webhook: string;
|
||||||
const: string;
|
const: string;
|
||||||
|
noResultsFound: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type LabelsConfigRaw = Partial<LabelsConfig>;
|
export type LabelsConfigRaw = Partial<LabelsConfig>;
|
||||||
|
@ -26,6 +27,7 @@ const labels: LabelsConfig = {
|
||||||
arrayOf: 'Array of ',
|
arrayOf: 'Array of ',
|
||||||
webhook: 'Event',
|
webhook: 'Event',
|
||||||
const: 'Value',
|
const: 'Value',
|
||||||
|
noResultsFound: 'No results found',
|
||||||
};
|
};
|
||||||
|
|
||||||
export function setRedocLabels(_labels?: LabelsConfigRaw) {
|
export function setRedocLabels(_labels?: LabelsConfigRaw) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user