Skip to content

Commit

Permalink
Fix UI issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jamdelion committed Dec 11, 2024
1 parent 688bff6 commit d91ce15
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
19 changes: 2 additions & 17 deletions editor.planx.uk/src/@planx/components/Question/OptionsEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from "react";
import Input from "ui/shared/Input/Input";

import {
BaseOptionsEditor,
Expand All @@ -16,22 +15,8 @@ const QuestionOptionsEditor: React.FC<BaseOptionsEditorProps> = ({
value={value}
onChange={onChange}
showValueField={showValueField}
>
<Input
value={value.data.description || ""}
placeholder="Description"
multiline
onChange={(ev) =>
onChange({
...value,
data: {
...value.data,
description: ev.target.value,
},
})
}
/>
</BaseOptionsEditor>
showDescriptionField={true}
/>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { FlagsSelect } from "./FlagsSelect";
export interface BaseOptionsEditorProps {
value: Option;
showValueField?: boolean;
showDescriptionField?: boolean;
onChange: (newVal: Option) => void;
children?: ReactNode;
}
Expand Down Expand Up @@ -50,8 +51,26 @@ export const BaseOptionsEditor: React.FC<BaseOptionsEditorProps> = (props) => (
});
}}
/>
{props.children}
</InputRow>
{props.children && <InputRow>{props.children}</InputRow>}
{props.showDescriptionField && (
<InputRow>
<Input
value={props.value.data.description || ""}
placeholder="Description"
multiline
onChange={(ev) =>
props.onChange({
...props.value,
data: {
...props.value.data,
description: ev.target.value,
},
})
}
/>
</InputRow>
)}
{props.showValueField && (
<InputRow>
<Input
Expand Down

0 comments on commit d91ce15

Please sign in to comment.