From 694fa17bdffd80998aee94f321cb43b50dc55f70 Mon Sep 17 00:00:00 2001 From: Connor Lanigan Date: Mon, 3 Oct 2022 11:08:39 +0200 Subject: [PATCH] feat: Prefill label creation with search term (#307) --- client/src/components/LabelsStep/AddStep.jsx | 5 +++-- client/src/components/LabelsStep/LabelsStep.jsx | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/client/src/components/LabelsStep/AddStep.jsx b/client/src/components/LabelsStep/AddStep.jsx index f064f594..5b1ffbc0 100755 --- a/client/src/components/LabelsStep/AddStep.jsx +++ b/client/src/components/LabelsStep/AddStep.jsx @@ -10,11 +10,11 @@ import Editor from './Editor'; import styles from './AddStep.module.scss'; -const AddStep = React.memo(({ onCreate, onBack }) => { +const AddStep = React.memo(({ onCreate, onBack, initialValue }) => { const [t] = useTranslation(); const [data, handleFieldChange] = useForm(() => ({ - name: '', + name: initialValue, color: LabelColors[0], })); @@ -48,6 +48,7 @@ const AddStep = React.memo(({ onCreate, onBack }) => { AddStep.propTypes = { onCreate: PropTypes.func.isRequired, onBack: PropTypes.func.isRequired, + initialValue: PropTypes.func.isRequired, }; export default AddStep; diff --git a/client/src/components/LabelsStep/LabelsStep.jsx b/client/src/components/LabelsStep/LabelsStep.jsx index 9928acfe..7307cb97 100755 --- a/client/src/components/LabelsStep/LabelsStep.jsx +++ b/client/src/components/LabelsStep/LabelsStep.jsx @@ -84,7 +84,7 @@ const LabelsStep = React.memo( if (step) { switch (step.type) { case StepTypes.ADD: - return ; + return ; case StepTypes.EDIT: { const currentItem = items.find((item) => item.id === step.params.id);