@@ -2,13 +2,37 @@ import * as React from "react";
22import { DataGrid } from "@mui/x-data-grid" ;
33import PropTypes from "prop-types" ;
44import Button from "@mui/material/Button" ;
5+ import Modal from "react-modal" ;
56
67function RenderDate ( props ) {
78 const { hasFocus, value } = props ;
89 const buttonElement = React . useRef ( null ) ;
910 const rippleRef = React . useRef ( null ) ;
11+ const [ modalIsOpen , setIsOpen ] = React . useState ( false ) ;
1012 const flagColor = props . value ;
1113
14+ const customStyles = {
15+ content : {
16+ top : "50%" ,
17+ left : "50%" ,
18+ width : "50%" ,
19+ right : "auto" ,
20+ bottom : "auto" ,
21+ marginRight : "-50%" ,
22+ transform : "translate(-50%, -50%)" ,
23+ color : "white" ,
24+ backgroundColor : "#394150" ,
25+ } ,
26+ } ;
27+
28+ function openModal ( ) {
29+ setIsOpen ( true ) ;
30+ }
31+
32+ function closeModal ( ) {
33+ setIsOpen ( false ) ;
34+ }
35+
1236 React . useLayoutEffect ( ( ) => {
1337 if ( hasFocus ) {
1438 const input = buttonElement . current ?. querySelector ( "input" ) ;
@@ -22,18 +46,100 @@ function RenderDate(props) {
2246 return (
2347 < >
2448 { flagColor === "green" && (
25- < button
26- className = "focus:outline-none text-white w-[8rem] bg-green-700 hover:bg-green-800 focus:ring-4 focus:ring-green-300 font-medium rounded-lg text-sm px-5 py-2.5 mr-2 mb-2 dark:bg-green-600 dark:hover:bg-green-700 dark:focus:ring-green-800"
27- >
28- Safe User
29- </ button >
49+ < >
50+ < button
51+ className = "focus:outline-none mt-2 text-white w-[8rem] bg-green-700 hover:bg-green-800 focus:ring-4 focus:ring-green-300 font-medium rounded-lg text-sm px-5 py-2.5 mr-2 mb-2 dark:bg-green-600 dark:hover:bg-green-700 dark:focus:ring-green-800"
52+ onClick = { ( ) => setIsOpen ( true ) }
53+ >
54+ Safe User
55+ </ button >
56+ { modalIsOpen && (
57+ < >
58+ < Modal
59+ isOpen = { modalIsOpen }
60+ onRequestClose = { closeModal }
61+ style = { customStyles }
62+ contentLabel = "Example Modal"
63+ >
64+ < div className = "flex justify-between" >
65+ < div className = "text-2xl" > Safe User</ div >
66+ < button onClick = { closeModal } className = "mx-6" >
67+ { " " }
68+ < svg
69+ aria-hidden = "true"
70+ className = "w-5 h-5"
71+ fill = "currentColor"
72+ viewBox = "0 0 20 20"
73+ xmlns = "http://www.w3.org/2000/svg"
74+ >
75+ < path
76+ fill-rule = "evenodd"
77+ d = "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
78+ clip-rule = "evenodd"
79+ > </ path >
80+ </ svg >
81+ </ button >
82+ </ div >
83+ < div className = "my-4" >
84+ { " " }
85+ The European Union’s General Data Protection Regulation
86+ (G.D.P.R.) goes into effect on May 25 and is meant to ensure a
87+ common set of data rights in the European Union. It requires
88+ organizations to notify users as soon as possible of high-risk
89+ data breaches that could personally affect them.
90+ </ div >
91+ </ Modal >
92+ </ >
93+ ) }
94+ </ >
3095 ) }
3196 { flagColor === "red" && (
32- < button
33- className = "focus:outline-none text-white w-[8rem] bg-red-700 hover:bg-red-800 focus:ring-4 focus:ring-red-300 font-medium rounded-lg text-sm px-5 py-2.5 mr-2 mb-2 dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-900"
34- >
35- Reported User
36- </ button >
97+ < >
98+ < button
99+ onClick = { ( ) => setIsOpen ( true ) }
100+ className = "focus:outline-none mt-2 text-white w-[8rem] bg-red-700 hover:bg-red-800 focus:ring-4 focus:ring-red-300 font-medium rounded-lg text-sm px-5 py-2.5 mr-2 mb-2 dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-900"
101+ >
102+ Reported User
103+ </ button >
104+ { modalIsOpen && (
105+ < >
106+ < Modal
107+ isOpen = { modalIsOpen }
108+ onRequestClose = { closeModal }
109+ style = { customStyles }
110+ contentLabel = "Example Modal"
111+ >
112+ < div className = "flex justify-between" >
113+ < div className = "text-2xl" > Reported User</ div >
114+ < button onClick = { closeModal } className = "mx-6" >
115+ { " " }
116+ < svg
117+ aria-hidden = "true"
118+ className = "w-5 h-5"
119+ fill = "currentColor"
120+ viewBox = "0 0 20 20"
121+ xmlns = "http://www.w3.org/2000/svg"
122+ >
123+ < path
124+ fill-rule = "evenodd"
125+ d = "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
126+ clip-rule = "evenodd"
127+ > </ path >
128+ </ svg >
129+ </ button >
130+ </ div >
131+ < div className = "my-4" >
132+ { " " }
133+ The European Union’s General Data Protection Regulation
134+ (G.D.P.R.) goes into effect on May 25 and is meant to ensure a
135+ common set of data rights in the European Union. It requires
136+ organizations to notify users as soon as possible of high-risk
137+ data breaches that could personally affect them.
138+ </ div >
139+ </ Modal >
140+ </ >
141+ ) }
142+ </ >
37143 ) }
38144 </ >
39145 ) ;
@@ -130,7 +236,12 @@ export default function AppGrid() {
130236 style = { { width : "100%" , backgroundColor : "white" } }
131237 className = "h-[100vh]"
132238 >
133- < DataGrid rows = { people } columns = { columns } disableRowSelectionOnClick className = "bg-[#394150]" style = { { color : 'white' } } />
239+ < DataGrid
240+ rows = { people }
241+ columns = { columns }
242+ className = "bg-[#394150]"
243+ style = { { color : "white" } }
244+ />
134245 </ div >
135246 ) ;
136247}
0 commit comments