mirror of
https://github.com/plankanban/planka.git
synced 2025-07-19 05:09:43 +02:00
ref: Little change for consistency
This commit is contained in:
parent
a5e8c5feec
commit
84e67f293c
2 changed files with 13 additions and 4 deletions
|
@ -10,12 +10,13 @@ import Editor from './Editor';
|
||||||
|
|
||||||
import styles from './AddStep.module.scss';
|
import styles from './AddStep.module.scss';
|
||||||
|
|
||||||
const AddStep = React.memo(({ onCreate, onBack, initialValue }) => {
|
const AddStep = React.memo(({ defaultData, onCreate, onBack }) => {
|
||||||
const [t] = useTranslation();
|
const [t] = useTranslation();
|
||||||
|
|
||||||
const [data, handleFieldChange] = useForm(() => ({
|
const [data, handleFieldChange] = useForm(() => ({
|
||||||
name: initialValue,
|
name: '',
|
||||||
color: LabelColors[0],
|
color: LabelColors[0],
|
||||||
|
...defaultData,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const handleSubmit = useCallback(() => {
|
const handleSubmit = useCallback(() => {
|
||||||
|
@ -46,9 +47,9 @@ const AddStep = React.memo(({ onCreate, onBack, initialValue }) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep.propTypes = {
|
AddStep.propTypes = {
|
||||||
|
defaultData: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
|
||||||
onCreate: PropTypes.func.isRequired,
|
onCreate: PropTypes.func.isRequired,
|
||||||
onBack: PropTypes.func.isRequired,
|
onBack: PropTypes.func.isRequired,
|
||||||
initialValue: PropTypes.func.isRequired,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default AddStep;
|
export default AddStep;
|
||||||
|
|
|
@ -84,7 +84,15 @@ const LabelsStep = React.memo(
|
||||||
if (step) {
|
if (step) {
|
||||||
switch (step.type) {
|
switch (step.type) {
|
||||||
case StepTypes.ADD:
|
case StepTypes.ADD:
|
||||||
return <AddStep onCreate={onCreate} onBack={handleBack} initialValue={search} />;
|
return (
|
||||||
|
<AddStep
|
||||||
|
defaultData={{
|
||||||
|
name: search,
|
||||||
|
}}
|
||||||
|
onCreate={onCreate}
|
||||||
|
onBack={handleBack}
|
||||||
|
/>
|
||||||
|
);
|
||||||
case StepTypes.EDIT: {
|
case StepTypes.EDIT: {
|
||||||
const currentItem = items.find((item) => item.id === step.params.id);
|
const currentItem = items.find((item) => item.id === step.params.id);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue