-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResponseModal.tsx
More file actions
53 lines (48 loc) · 1.66 KB
/
ResponseModal.tsx
File metadata and controls
53 lines (48 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { useParams } from 'react-router-dom';
import TextButton from '../../../../../design-system/ui/buttons/TextButton';
import SelectTicketInfo from '../ticket/SelectTicketInfo';
import { useTickets } from '../../../../features/ticket/hooks/useTicketHook';
import { useResponseStore } from '../../../../features/dashboard/model/store/ResponseStore';
interface ResponesModalProps {
onClose: () => void;
}
const ResponesModal = ({ onClose }: ResponesModalProps) => {
const { id } = useParams();
const eventId = id ? parseInt(id) : 0;
const { data, isLoading } = useTickets(eventId);
const tickets = data?.result ?? [];
const { setSelectedTicketId } = useResponseStore();
const handleClick = (ticketId: number) => {
setSelectedTicketId(ticketId);
onClose();
};
return (
<div className="fixed inset-0 flex items-center justify-center w-full max-w-lg h-full mx-auto bg-black bg-opacity-30 z-50">
<div className="flex flex-col w-[95%] px-4 py-6 gap-3 rounded-[5px] bg-white">
<div className="flex gap-3 mb-2">
<TextButton
label="<"
onClick={() => {
onClose();
}}
/>
<h1 className="font-bold text-lg sm:text-sm">응답을 확인할 티켓을 선택하세요</h1>
</div>
{isLoading ? (
<div>로딩 중...</div>
) : (
tickets.map(ticket => (
<SelectTicketInfo
key={ticket.ticketId}
tickets={ticket}
onClick={() => {
handleClick(ticket.ticketId);
}}
/>
))
)}
</div>
</div>
);
};
export default ResponesModal;