Skip to content

Commit a61c939

Browse files
committed
modalのdaisyUI移行を完了
1 parent f3e6f2c commit a61c939

File tree

1 file changed

+13
-20
lines changed

1 file changed

+13
-20
lines changed

web/components/common/modal/ModalProvider.tsx

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,9 @@
1-
import { Box } from "@mui/material";
2-
import { styled } from "@mui/system";
31
import { type ReactNode, createContext, useContext, useState } from "react";
42
import { useMyID } from "~/api/user";
53
import type { User } from "~/common/types";
64
import { Card } from "../../Card";
75

8-
const Overlay = styled(Box)({
9-
position: "fixed",
10-
top: 0,
11-
left: 0,
12-
width: "100vw",
13-
height: "100vh",
14-
backgroundColor: "rgba(0, 0, 0, 0.5)",
15-
display: "flex",
16-
alignItems: "center",
17-
justifyContent: "center",
18-
zIndex: 1000,
19-
});
6+
const ModalContext = createContext<ModalContextProps | undefined>(undefined);
207

218
type ModalContextProps = {
229
openModal: (user: User) => void;
@@ -27,8 +14,6 @@ type ModalProviderProps = {
2714
children: ReactNode;
2815
};
2916

30-
const ModalContext = createContext<ModalContextProps | undefined>(undefined);
31-
3217
export const ModalProvider = ({ children }: ModalProviderProps) => {
3318
const [open, setOpen] = useState(false);
3419
const [selectedUser, setSelectedUser] = useState<User | null>(null);
@@ -50,14 +35,22 @@ export const ModalProvider = ({ children }: ModalProviderProps) => {
5035
<ModalContext.Provider value={{ openModal, closeModal }}>
5136
{children}
5237
{open && selectedUser && (
53-
<Overlay onClick={closeModal}>
54-
<Box onClick={(e) => e.stopPropagation()}>
38+
// biome-ignore lint/a11y/useKeyWithClickEvents: <explanation>
39+
<div
40+
className="fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50"
41+
onClick={closeModal}
42+
>
43+
{/* biome-ignore lint/a11y/useKeyWithClickEvents: <explanation> */}
44+
<div
45+
className="rounded bg-white p-4 shadow-lg"
46+
onClick={(e) => e.stopPropagation()}
47+
>
5548
<Card
5649
displayedUser={selectedUser}
5750
comparisonUserId={myId ? myId : undefined}
5851
/>
59-
</Box>
60-
</Overlay>
52+
</div>
53+
</div>
6154
)}
6255
</ModalContext.Provider>
6356
);

0 commit comments

Comments
 (0)