@@ -69,3 +69,49 @@ const Ultra = {
6969 } , 10000 ) ;
7070 }
7171} ;
72+
73+ Ultra . modal = function ( { head = "Modal" , text = "" } ) {
74+ const modalOverlay = document . createElement ( "div" ) ;
75+ modalOverlay . className = "ultra-modal-container" ;
76+ modalOverlay . style . position = "fixed" ;
77+ modalOverlay . style . top = "0" ;
78+ modalOverlay . style . left = "0" ;
79+ modalOverlay . style . width = "100vw" ;
80+ modalOverlay . style . height = "100vh" ;
81+ modalOverlay . style . background = "rgba(0, 0, 0, 0.5)" ;
82+ modalOverlay . style . display = "flex" ;
83+ modalOverlay . style . justifyContent = "center" ;
84+ modalOverlay . style . alignItems = "center" ;
85+ modalOverlay . style . zIndex = "9999" ;
86+
87+ const modal = document . createElement ( "div" ) ;
88+ modal . className = "ultra-modal" ;
89+ modal . style . background = "white" ;
90+ modal . style . padding = "30px" ;
91+ modal . style . borderRadius = "10px" ;
92+ modal . style . maxWidth = "90%" ;
93+ modal . style . width = "400px" ;
94+ modal . style . position = "relative" ;
95+ modal . style . boxShadow = "0 10px 30px rgba(0,0,0,0.3)" ;
96+ modal . style . textAlign = "center" ;
97+
98+ const modalHead = document . createElement ( "h2" ) ;
99+ modalHead . className = "ultra-modal-head" ;
100+ modalHead . textContent = head ;
101+
102+ const modalText = document . createElement ( "p" ) ;
103+ modalText . className = "ultra-modal-text" ;
104+ modalText . textContent = text ;
105+
106+ const closeBtn = document . createElement ( "button" ) ;
107+ closeBtn . className = "ultra-modal-close ultra-button button-wave" ;
108+ closeBtn . textContent = "Close" ;
109+ closeBtn . style . marginTop = "20px" ;
110+ closeBtn . onclick = ( ) => modalOverlay . remove ( )
111+
112+ modal . appendChild ( modalHead ) ;
113+ modal . appendChild ( modalText ) ;
114+ modal . appendChild ( closeBtn ) ;
115+ modalOverlay . appendChild ( modal ) ;
116+ document . body . appendChild ( modalOverlay ) ;
117+ } ;
0 commit comments