File tree Expand file tree Collapse file tree 3 files changed +47
-1
lines changed Expand file tree Collapse file tree 3 files changed +47
-1
lines changed Original file line number Diff line number Diff line change @@ -3,11 +3,13 @@ import { BrowserRouter as Router } from 'react-router-dom';
3
3
import Sidebar from './components/Sidebar' ;
4
4
import AppRoutes from './routes/AppRoutes' ;
5
5
import { useAuth } from './context/authContext/authContext' ;
6
-
6
+ import NewsletterModal from './Newslettermodal' ;
7
7
const App = ( ) => {
8
8
const { userLoggedIn } = useAuth ( ) ;
9
9
10
10
return (
11
+ < >
12
+ < NewsletterModal />
11
13
< Router >
12
14
< div className = "flex" >
13
15
{ userLoggedIn && < Sidebar /> } { /* Show Sidebar if authenticated */ }
@@ -16,6 +18,8 @@ const App = () => {
16
18
</ div >
17
19
</ div >
18
20
</ Router >
21
+
22
+ </ >
19
23
) ;
20
24
} ;
21
25
Original file line number Diff line number Diff line change
1
+ import { useEffect , useState } from 'react' ;
2
+
3
+ function NewsletterModal ( ) {
4
+ const [ isOpen , setIsOpen ] = useState ( false ) ;
5
+
6
+ useEffect ( ( ) => {
7
+ // Open the modal on page load
8
+ setIsOpen ( true ) ;
9
+ } , [ ] ) ;
10
+
11
+ const closeModal = ( ) => {
12
+ setIsOpen ( false ) ;
13
+ } ;
14
+
15
+ return (
16
+ < >
17
+ { isOpen && (
18
+ < div className = "fixed inset-0 flex items-center justify-center bg-black bg-opacity-50 z-50" >
19
+ < div className = "relative" >
20
+
21
+ { /* Close Button */ }
22
+ < button
23
+ className = "absolute top-2 right-2 bg-white rounded-full p-1 text-gray-600 hover:text-gray-800"
24
+ onClick = { closeModal }
25
+ >
26
+ ✕
27
+ </ button >
28
+
29
+ { /* Image section */ }
30
+ < img
31
+ src = "/teckinka2.jpeg"
32
+ alt = "Sample"
33
+ className = "w-full max-w-md h-auto rounded-lg shadow-lg"
34
+ />
35
+ </ div >
36
+ </ div >
37
+ ) }
38
+ </ >
39
+ ) ;
40
+ }
41
+
42
+ export default NewsletterModal ;
You can’t perform that action at this time.
0 commit comments