Fix placeholder in string list input (#3257)

This commit is contained in:
WithoutPants
2022-12-09 12:05:05 +11:00
committed by GitHub
parent 2715dcb72a
commit a67eee8f4c
2 changed files with 4 additions and 3 deletions

View File

@@ -429,7 +429,7 @@ export const StringListSetting: React.FC<IStringListSetting> = (props) => {
<StringListInput
value={value ?? []}
setValue={setValue}
defaultNewValue={props.defaultNewValue}
placeholder={props.defaultNewValue}
/>
)}
renderValue={(value) => (

View File

@@ -6,13 +6,13 @@ import Icon from "src/components/Shared/Icon";
interface IStringListInputProps {
value: string[];
setValue: (value: string[]) => void;
defaultNewValue?: string;
placeholder?: string;
className?: string;
errors?: string;
}
export const StringListInput: React.FC<IStringListInputProps> = (props) => {
const values = props.value.concat(props.defaultNewValue || "");
const values = props.value.concat("");
function valueChanged(idx: number, value: string) {
const newValues = values
@@ -43,6 +43,7 @@ export const StringListInput: React.FC<IStringListInputProps> = (props) => {
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
valueChanged(i, e.currentTarget.value)
}
placeholder={props.placeholder}
/>
<InputGroup.Append>
<Button