1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-23 07:09:44 +02:00

feat: Version 2

Closes #627, closes #1047
This commit is contained in:
Maksim Eltyshev 2025-05-10 02:09:06 +02:00
parent ad7fb51cfa
commit 2ee1166747
1557 changed files with 76832 additions and 47042 deletions

View file

@ -1,55 +0,0 @@
import React, { useCallback } from 'react';
import PropTypes from 'prop-types';
import { useTranslation } from 'react-i18next';
import { Button, Form } from 'semantic-ui-react';
import { Popup } from '../../lib/custom-ui';
import { useForm } from '../../hooks';
import LabelColors from '../../constants/LabelColors';
import Editor from './Editor';
import styles from './AddStep.module.scss';
const AddStep = React.memo(({ defaultData, onCreate, onBack }) => {
const [t] = useTranslation();
const [data, handleFieldChange] = useForm(() => ({
name: '',
color: LabelColors[0],
...defaultData,
}));
const handleSubmit = useCallback(() => {
const cleanData = {
...data,
name: data.name.trim() || null,
};
onCreate(cleanData);
onBack();
}, [data, onCreate, onBack]);
return (
<>
<Popup.Header onBack={onBack}>
{t('common.createLabel', {
context: 'title',
})}
</Popup.Header>
<Popup.Content>
<Form onSubmit={handleSubmit}>
<Editor data={data} onFieldChange={handleFieldChange} />
<Button positive content={t('action.createLabel')} className={styles.submitButton} />
</Form>
</Popup.Content>
</>
);
});
AddStep.propTypes = {
defaultData: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
onCreate: PropTypes.func.isRequired,
onBack: PropTypes.func.isRequired,
};
export default AddStep;