mirror of
https://github.com/status-im/spiff-arena.git
synced 2025-01-30 19:56:20 +00:00
also support placeholder text w/ burnettk
This commit is contained in:
parent
80ab47aeff
commit
e45d6c4732
@ -11,6 +11,7 @@ interface typeaheadArgs {
|
|||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
readonly?: boolean;
|
readonly?: boolean;
|
||||||
rawErrors?: any;
|
rawErrors?: any;
|
||||||
|
placeholder?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function TypeaheadWidget({
|
export default function TypeaheadWidget({
|
||||||
@ -21,6 +22,7 @@ export default function TypeaheadWidget({
|
|||||||
uiSchema,
|
uiSchema,
|
||||||
disabled,
|
disabled,
|
||||||
readonly,
|
readonly,
|
||||||
|
placeholder,
|
||||||
rawErrors = [],
|
rawErrors = [],
|
||||||
}: typeaheadArgs) {
|
}: typeaheadArgs) {
|
||||||
const lastSearchTerm = useRef('');
|
const lastSearchTerm = useRef('');
|
||||||
@ -69,6 +71,11 @@ export default function TypeaheadWidget({
|
|||||||
return str;
|
return str;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let placeholderText = `Start typing to search...`;
|
||||||
|
if (placeholder) {
|
||||||
|
placeholderText = placeholder;
|
||||||
|
}
|
||||||
|
|
||||||
let helperText = null;
|
let helperText = null;
|
||||||
if (uiSchema && uiSchema['ui:help']) {
|
if (uiSchema && uiSchema['ui:help']) {
|
||||||
helperText = uiSchema['ui:help'];
|
helperText = uiSchema['ui:help'];
|
||||||
@ -91,7 +98,7 @@ export default function TypeaheadWidget({
|
|||||||
id={id}
|
id={id}
|
||||||
items={items}
|
items={items}
|
||||||
itemToString={itemToString}
|
itemToString={itemToString}
|
||||||
placeholder={`Start typing to search for ${category}...`}
|
placeholder={placeholderText}
|
||||||
selectedItem={selectedItem}
|
selectedItem={selectedItem}
|
||||||
helperText={helperText}
|
helperText={helperText}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user