рефакторинг
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import styles from './SearchableSelect.module.scss';
|
||||
import { Icon } from './Icon';
|
||||
import { texts } from '../../texts';
|
||||
|
||||
export interface IAsyncSearchResult<T> {
|
||||
items: T[];
|
||||
@@ -33,11 +34,11 @@ export function AsyncSearchableSelect<T>({
|
||||
getValue,
|
||||
getLabel,
|
||||
getSublabel,
|
||||
placeholder = 'Выберите значение',
|
||||
searchPlaceholder = 'Поиск...',
|
||||
placeholder = texts.select.placeholder,
|
||||
searchPlaceholder = texts.select.searchPlaceholder,
|
||||
disabled,
|
||||
allowClear,
|
||||
clearLabel = 'Не выбрано',
|
||||
clearLabel = texts.select.notSelected,
|
||||
debounceMs = 350
|
||||
}: IAsyncSearchableSelectProps<T>): React.ReactElement {
|
||||
const [open, setOpen] = React.useState(false);
|
||||
@@ -176,10 +177,10 @@ export function AsyncSearchableSelect<T>({
|
||||
onChange={e => setQuery(e.target.value)}
|
||||
/>
|
||||
<div className={styles.list} ref={listRef}>
|
||||
{loading && <div className={styles.empty}>Поиск...</div>}
|
||||
{loading && <div className={styles.empty}>{texts.select.searching}</div>}
|
||||
{!loading && error && <div className={styles.errorText}>{error}</div>}
|
||||
{!loading && !error && items.length === 0 && (
|
||||
<div className={styles.empty}>Ничего не найдено</div>
|
||||
<div className={styles.empty}>{texts.select.nothingFound}</div>
|
||||
)}
|
||||
{!loading && !error && items.map(item => {
|
||||
const itemValue = getValue(item);
|
||||
|
||||
Reference in New Issue
Block a user