Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Ivan Moreno <imoreno@carto.com>
  • Loading branch information
vmilan and Josmorsot authored Jun 20, 2024
1 parent 6d489e9 commit eb1ddb3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export type AutocompleteProps<
ChipComponent extends React.ElementType = ChipTypeMap['defaultComponent']
> = MuiAutocompleteProps<Value, Multiple, DisableClearable, FreeSolo, ChipComponent> & {
creatable?: boolean;
newItemTitle?: React.ReactNode | string;
newItemTitle?: string | (value: string) => (React.ReactNode | string);
newItemIcon?: React.ReactNode;
};

Expand Down
2 changes: 1 addition & 1 deletion packages/react-ui/src/components/molecules/Autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const Autocomplete = forwardRef(
if (inputValue.length > 1 && inputValue !== '' && !isExisting) {
filtered.push({
inputValue,
title: `${intlConfig.formatMessage({ id: newItemTitle })} "${inputValue}"`
title: typeof newItemTitle === 'function' ? newItemTitle(inputValue) : `${newItemTitle} "${inputValue}"`
});
}

Expand Down

0 comments on commit eb1ddb3

Please sign in to comment.