Skip to content

Commit 68c50a4

Browse files
separate modal from kanban view
1 parent 96e2ed0 commit 68c50a4

File tree

1 file changed

+97
-0
lines changed

1 file changed

+97
-0
lines changed
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
import Flex from "antd/es/flex"
2+
import Input from "antd/es/input"
3+
import Modal from "antd/es/modal"
4+
import Select from "antd/es/select"
5+
import Typography from "antd/es/typography"
6+
import React, { useEffect } from "react"
7+
import { useState } from "react"
8+
9+
interface IProps {
10+
open: boolean;
11+
data: Record<string, string>;
12+
statusOptions: Array<Record<string, string>>;
13+
assigneeOptions: Array<Record<string, string>>;
14+
onOk: (data: Record<string, string>) => void;
15+
onCancel: () => void;
16+
}
17+
18+
const KanbanCardModal = ({
19+
open,
20+
data,
21+
onOk,
22+
onCancel,
23+
statusOptions,
24+
assigneeOptions,
25+
}: IProps) => {
26+
const [dialogData, setDialogData] = useState<Record<string,string>>({});
27+
28+
// const handleOk = () => {
29+
// setIsModalOpen(false);
30+
// };
31+
32+
// const handleCancel = () => {
33+
// onCancel();
34+
// };
35+
36+
useEffect(() => {
37+
if (open) { setDialogData(data); }
38+
else { setDialogData({}) }
39+
}, [open]);
40+
41+
return (
42+
<Modal
43+
title="Edit Task"
44+
open={open}
45+
onOk={() => onOk(dialogData)}
46+
onCancel={onCancel}
47+
okText="Update"
48+
maskClosable={false}
49+
>
50+
<Flex vertical gap={10}>
51+
<Typography.Title level={5}>Title</Typography.Title>
52+
<Input
53+
placeholder={'Label'}
54+
onChange={(e) =>
55+
setDialogData((prev) => ({...prev, label: e.target.value}))
56+
}
57+
value={dialogData.label}
58+
/>
59+
<Typography.Title level={5}>Status</Typography.Title>
60+
<Select
61+
value={dialogData.status}
62+
// style={{ width: 120 }}
63+
onChange={(value) =>
64+
setDialogData((prev) => ({...prev, status: value}))
65+
}
66+
options={statusOptions}
67+
/>
68+
<Typography.Title level={5}>Assignee</Typography.Title>
69+
<Select
70+
value={dialogData.assignee}
71+
onChange={(value) =>
72+
setDialogData((prev) => ({...prev, assignee: value}))
73+
}
74+
options={assigneeOptions}
75+
/>
76+
<Typography.Title level={5}>Summary</Typography.Title>
77+
<Input
78+
placeholder={'Summary'}
79+
onChange={(e) =>
80+
setDialogData((prev) => ({...prev, summary: e.target.value}))
81+
}
82+
value={dialogData.summary}
83+
/>
84+
<Typography.Title level={5}>Tags</Typography.Title>
85+
<Input
86+
placeholder={'Tags'}
87+
onChange={(e) =>
88+
setDialogData((prev) => ({...prev, tags: e.target.value}))
89+
}
90+
value={dialogData.tags}
91+
/>
92+
</Flex>
93+
</Modal>
94+
)
95+
}
96+
97+
export default React.memo(KanbanCardModal);

0 commit comments

Comments
 (0)