Skip to content

Commit

Permalink
Merge pull request #886 from CherifAmine/originbbbeasy/clearData_from…
Browse files Browse the repository at this point in the history
…Modal
  • Loading branch information
GhaziTriki authored Aug 30, 2023
2 parents 36e9db8 + 2e175fb commit 3db340a
Show file tree
Hide file tree
Showing 3 changed files with 209 additions and 196 deletions.
9 changes: 5 additions & 4 deletions bbbeasy-frontend/src/components/AddLabelForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,14 @@ type formType = {
let addForm: FormInstance = null;

export const AddLabelForm = (props: Props) => {
const [initialColor, setInitialColor] = React.useState<string>('#fbbc0b');
const { defaultColor } = props;
const initialAddValues: formType = {
name: '',
description: '',
color: '#fbbc0b',
color: initialColor,
};
const [color, setColor] = React.useState<string>(defaultColor ? defaultColor : '#fbbc0b');
const [color, setColor] = React.useState<string>(defaultColor ? defaultColor : initialColor);
const dataContext = React.useContext(DataContext);
const [data, setData] = React.useState<LabelType[]>([]);
const [loading, setLoading] = React.useState<boolean>(false);
Expand Down Expand Up @@ -87,8 +88,8 @@ export const AddLabelForm = (props: Props) => {
};
const cancelAdd = () => {
props.close();

addForm?.resetFields();
setColor(initialColor);
};

const failedAdd = () => {
Expand All @@ -102,7 +103,7 @@ export const AddLabelForm = (props: Props) => {
centered
open={props.isModalShow}
onOk={handleAdd}
onCancel={props.close}
onCancel={cancelAdd}
footer={null}
maskClosable={true}
>
Expand Down
2 changes: 1 addition & 1 deletion bbbeasy-frontend/src/components/AddPresetForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export const AddPresetForm = (props: Props) => {
centered
open={props.isModalShow}
onOk={handleAdd}
onCancel={props.close}
onCancel={cancelAdd}
footer={null}
maskClosable={true}
>
Expand Down
Loading

0 comments on commit 3db340a

Please sign in to comment.