Skip to content

Commit f3272df

Browse files
committed
added popup on home page
1 parent 40c91de commit f3272df

File tree

4 files changed

+61
-1
lines changed

4 files changed

+61
-1
lines changed

public/sneakpeak.svg

Lines changed: 1 addition & 0 deletions
Loading

src/app/page.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ import Courses from "@/components/courses";
66
import Finder from "@/components/internship-finder";
77
import Features from "@/components/features";
88
import Approach from "@/components/approach";
9+
import Popup from "@/components/popup";
910
import { Box } from "@chakra-ui/react";
1011

1112
export default function Home() {
1213

1314
return (
1415
<Box my={["20px", "130px"]} px={5}>
16+
<Popup />
1517
<HeroHeader />
1618
<Courses />
1719
<Features />

src/components/form.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function Form({ questions = [], role = "" }) {
6363
if (response.ok) {
6464
toast({
6565
title: 'Congrats!',
66-
description: 'We have received your application. We will reach out to you soon!',
66+
description: 'We have received your application. We will reach out to you soon! ',
6767
status: 'success',
6868
duration: 5000,
6969
isClosable: true,

src/components/popup.jsx

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import {
2+
Box,
3+
Button,
4+
Image,
5+
Modal,
6+
ModalOverlay,
7+
ModalContent,
8+
ModalHeader,
9+
ModalCloseButton,
10+
Text,
11+
ModalBody,
12+
ModalFooter,
13+
useDisclosure,
14+
} from "@chakra-ui/react";
15+
import React, { useEffect, useState } from "react";
16+
17+
function Popup() {
18+
const { isOpen, onOpen, onClose } = useDisclosure();
19+
const [isFirstTime, setIsFirstTime] = useState(false);
20+
21+
useEffect(() => {
22+
if (typeof window !== "undefined") {
23+
const seenPopup = localStorage.getItem("seenPopup");
24+
if (!seenPopup || seenPopup === "false") {
25+
setIsFirstTime(true);
26+
onOpen();
27+
localStorage.setItem("seenPopup", "true");
28+
}
29+
}
30+
}, [onOpen]);
31+
32+
return (
33+
<Modal isOpen={isFirstTime && isOpen} onClose={onClose}>
34+
<ModalOverlay />
35+
<ModalContent>
36+
<ModalHeader color="blackAlpha.900">Check Out Our Dashboard</ModalHeader>
37+
38+
<ModalCloseButton color="black" />
39+
<ModalBody>
40+
<Text color="blackAlpha.900">
41+
We have a learning platform where you can learn about various technologies and increase your knowledge for free.
42+
</Text>
43+
<Image src="/sneakpeak.svg" alt="Dashboard Image" />
44+
</ModalBody>
45+
46+
<Button colorScheme="blue" my={4} mx={8} as="a" href="https://dashboard.techoptimum.org">
47+
Check out 15+ coding courses
48+
</Button>
49+
50+
51+
</ModalContent>
52+
</Modal>
53+
);
54+
}
55+
56+
export default Popup;
57+

0 commit comments

Comments
 (0)