1- import { Box } from "@mui/material" ;
2- import { styled } from "@mui/system" ;
31import { type ReactNode , createContext , useContext , useState } from "react" ;
42import { useMyID } from "~/api/user" ;
53import type { User } from "~/common/types" ;
64import { 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
218type 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-
3217export 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