Skip to content

Commit 2b062c2

Browse files
authored
Merge branch 'main' into Illaf2
2 parents c7bcc9e + ef56939 commit 2b062c2

File tree

7 files changed

+222
-17
lines changed

7 files changed

+222
-17
lines changed

README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,85 @@ DevsInTech offers a wide range of resources and opportunities for developers and
4848

4949
[![Next.js](https://img.shields.io/badge/next.js-%2320232a.svg?style=for-the-badge&logo=next.js&logoColor=%2361DAFB)](https://nextjs.org/) [![TailwindCSS](https://img.shields.io/badge/Tailwind_CSS-%23326ce9.svg?style=for-the-badge&logo=tailwindcss&logoColor=white)](https://tailwindcss.com/)
5050

51+
## Getting Started 👩‍💻
52+
53+
> ⚠️Prerequisites
54+
>
55+
> - Before getting into it, make sure you have [pnpm](https://nodejs.org/download) installed.
56+
57+
58+
### Let's jump right in🌟
59+
60+
1. Fork the project
61+
2. Clone the project to run on your local machine using the following command:
62+
63+
```sh
64+
git clone https://github.com/<your_github_username>/DevsInTech.git
65+
```
66+
67+
3. Get into the root directory
68+
69+
```sh
70+
cd DevsInTech
71+
```
72+
73+
4. Install all dependencies by running
74+
75+
```sh
76+
pnpm install
77+
```
78+
79+
5. Create your branch
80+
81+
```sh
82+
git checkout -b <your_branch_name>
83+
```
84+
85+
6. Run and view the application on localhost
86+
87+
```sh
88+
pnpm run dev
89+
```
90+
91+
7. Make your changes
92+
93+
8. Stage your changes
94+
95+
```sh
96+
git add <filename>
97+
```
98+
99+
9. Commit your changes
100+
101+
```sh
102+
git commit -m "<your-commit-message>"
103+
```
104+
105+
10. Push your changes to your branch
106+
107+
```sh
108+
git push origin "<your_branch_name>"
109+
```
110+
111+
11. Create a Pull Request.
112+
113+
> Click _compare across forks_ if you don't see your branch
114+
115+
### Setup using Docker
116+
117+
* Enter the root directory
118+
119+
```sh
120+
docker build .
121+
122+
```
123+
124+
125+
```sh
126+
docker run -p 3000:80 <Image>
127+
```
128+
129+
51130
# Contribute
52131
53132
We welcome contributions in our community. Learn how to start contributing, from installing the project on your device to submitting a pull request with our<Link href="https://github.com/devs-in-tech/DevsInTech/blob/main/CONTRIBUTING.md"> Contribution guide.<Link/>

public/check-markf.png

18.2 KB
Loading

src/components/Footer.jsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
import Image from "next/image";
42
import Link from "next/link";
53
import {

src/components/Letter.jsx

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
import axios from "axios";
2+
import Image from "next/image";
3+
import { useState } from "react";
4+
5+
export default function Letter() {
6+
const [email, setEmail] = useState("");
7+
const [subscriptionSuccess, setSubscriptionSuccess] = useState(false);
8+
9+
const handleSubmit = (e) => {
10+
e.preventDefault();
11+
12+
// Make the POST request using Axios
13+
axios
14+
.post("/api/subscribes", { email })
15+
.then((response) => {
16+
// Handle the success response here
17+
console.log(response.data);
18+
setSubscriptionSuccess(true);
19+
})
20+
.catch((error) => {
21+
// Handle the error here
22+
console.error(error);
23+
});
24+
};
25+
26+
const handleEmailChange = (e) => {
27+
setEmail(e.target.value);
28+
};
29+
30+
return (
31+
<section className="bg-black ">
32+
<div className="py-8 px-4 mx-auto max-w-screen-xl lg:py-16 lg:px-6">
33+
<div className="mx-auto max-w-screen-md sm:text-center">
34+
{subscriptionSuccess ? (
35+
<div className="bg-black-500 text-white p-4 mb-4 rounded-lg flex flex-col items-center justify-center border-2 border-solid focus:border-primary-500 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-primary-500 dark:focus:border-primary-500">
36+
<div className="w-12 h-12 mb-2 animate-bounce">
37+
<Image
38+
src="/check-markf.png"
39+
alt="Success Icon"
40+
width={68}
41+
height={68}
42+
/>
43+
</div>
44+
<span className="text-center text-3xl mt-2">
45+
We&apos;ve sent a confirmation email
46+
<br />
47+
Click on the link to complete your subscription to this
48+
newsletter.
49+
</span>
50+
</div>
51+
) : (
52+
<>
53+
<h2 className="sm:text-3xl md:text-4xl text-xl font-bold text-transparent bg-clip-text bg-gradient-to-r from-purple-400 via-green-400 to-purple-400">
54+
Subscribe to our newsletter
55+
</h2>
56+
<p className="mx-auto mb-8 mt-4 max-w-2xl font-secondary text-white-500 md:mb-12 sm:text-xl dark:text-white">
57+
Read articles from DevsInTech Blogs directly inside your inbox.
58+
Subscribe to the newsletter, and don&apos;t miss out.
59+
</p>
60+
<form action="#" onSubmit={handleSubmit}>
61+
<div className="items-center mx-auto mb-3 space-y-4 max-w-screen-sm sm:flex sm:space-y-0">
62+
<div className="relative w-full">
63+
<label
64+
htmlFor="email"
65+
className="hidden mb-2 text-sm font-medium text-gray-900 dark:text-gray-300"
66+
>
67+
Email address
68+
</label>
69+
<div className="flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none ">
70+
<svg
71+
className="w-5 h-5 text-gray-500 dark:text-gray-400"
72+
fill="currentColor"
73+
viewBox="0 0 20 20"
74+
xmlns="http://www.w3.org/2000/svg"
75+
>
76+
<path d="M2.003 5.884L10 9.882l7.997-3.998A2 2 0 0016 4H4a2 2 0 00-1.997 1.884z" />
77+
<path d="M18 8.118l-8 4-8-4V14a2 2 0 002 2h12a2 2 0 002-2V8.118z" />
78+
</svg>
79+
</div>
80+
<input
81+
className="block p-3 pl-10 w-full text-sm text-gray-900 bg-gray-50 rounded-lg border border-gray-300 sm:rounded-none sm:rounded-l-lg focus:ring-primary-500 focus:border-primary-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-primary-500 dark:focus:border-primary-500"
82+
placeholder="Enter your email"
83+
type="email"
84+
id="email"
85+
required=""
86+
value={email}
87+
onChange={handleEmailChange}
88+
/>
89+
</div>
90+
<div>
91+
<button
92+
type="submit"
93+
className="py-3 px-5 w-full text-sm font-medium text-center text-white rounded-lg border cursor-pointer bg-primary-700 border-primary-600 sm:rounded-none sm:rounded-r-lg hover:bg-primary-800 focus:ring-4 focus:ring-primary-300 dark:bg-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800 bg-gradient-to-r from-indigo-800 to-purple-500"
94+
>
95+
Subscribe
96+
</button>
97+
</div>
98+
</div>
99+
</form>
100+
</>
101+
)}
102+
</div>
103+
</div>
104+
</section>
105+
);
106+
}

src/components/Navbar.jsx

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import Image from "next/image";
22
import Link from "next/link";
33
import { useState } from "react";
44
import Logo from "../../public/logo2.png";
5-
// import Button from "./button";
65
import HeaderSocialMedia from "./HeaderSocialMedia";
76

87
const Navbar = () => {
@@ -12,25 +11,23 @@ const Navbar = () => {
1211
{ name: "Events", link: "/events" },
1312
{ name: "Team", link: "/team" },
1413
{ name: "FAQs", link: "/#faqs" },
15-
{ name: "Contributors", link: "/Contributors" }
14+
{ name: "Contributors", link: "/Contributors" },
1615
];
1716
let [open, setOpen] = useState(false);
1817
return (
19-
<div className="w-full z-999 top-0 left-0 sticky bg-black">
18+
<div className="w-full z-999 top-0 left-0 sticky bg-black bg-opacity-75 shadow-lg">
2019
<div className="md:flex md:items-center md:justify-between py-4 px-7">
21-
<div
22-
className="font-bold text-base cursor-pointer flex flex-col md:items-center font-secondary
23-
text-white"
24-
>
20+
<div className="font-bold text-base cursor-pointer flex flex-col md:items-center font-secondary text-white">
2521
<span>
2622
<Image className="h-14 w-14" src={Logo} alt="" />
2723
</span>
2824
DevsInTech
2925
</div>
3026

3127
<ul
32-
className={`md:flex md:items-center md:pb-0 px-20 md:px-0 pb-12 md:justify-center absolute md:static md:z-auto left-0 w-full transition-all duration-500 ease-in ${open ? "top-24 bg-black" : "top-[-550px]"
33-
}`}
28+
className={`md:flex md:items-center md:pb-0 px-20 md:px-0 pb-12 md:justify-center absolute md:static md:z-auto left-0 w-full transition-all duration-500 ease-in ${
29+
open ? "top-24 bg-black" : "top-[-550px]"
30+
}`}
3431
>
3532
{Links.map((link) => (
3633
<li
@@ -40,11 +37,7 @@ const Navbar = () => {
4037
>
4138
<Link
4239
href={link.link}
43-
className="text-white font-3 hover:text-transparent bg-clip-text bg-gradient-to-r from-[#AF7AF2] via-[#A5F7A8] to-[#AF7AF2] duration-200
44-
relative transition-all duration-500 before:content-[''] before:absolute before:-bottom-2
45-
before:left-0 before:w-0 before:h-1 before:opacity-0 before:transition-all before:duration-500
46-
before:bg-gradient-to-r hover:before:w-full hover:before:opacity-100
47-
"
40+
className="text-white font-3 hover:text-transparent bg-clip-text bg-gradient-to-r from-[#AF7AF2] via-[#A5F7A8] to-[#AF7AF2] duration-200 relative transition-all duration-500 before:content-[''] before:absolute before:-bottom-2 before:left-0 before:w-0 before:h-1 before:opacity-0 before:transition-all before:duration-500 before:bg-gradient-to-r hover:before:w-full hover:before:opacity-100"
4841
>
4942
{link.name}
5043
</Link>
@@ -80,4 +73,3 @@ const Navbar = () => {
8073
};
8174

8275
export default Navbar;
83-

src/pages/api/subscribes.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import axios from "axios";
2+
3+
export default async function handler(req, res) {
4+
try {
5+
const { email } = req.body;
6+
const publicationId = process.env.NEXT_PUBLIC_PUBLICATION_ID;
7+
8+
// Make the API call to subscribe to the newsletter
9+
const response = await axios.post(
10+
"https://devsintech.hashnode.dev/api/newsletter/subscribe",
11+
{
12+
email,
13+
publicationId,
14+
}
15+
);
16+
17+
// Handle the response from the API call
18+
if (response.status === 200) {
19+
res
20+
.status(200)
21+
.json({ message: "Subscribed to the newsletter successfully!" });
22+
} else {
23+
res.status(500).json({ error: "Error subscribing to the newsletter" });
24+
}
25+
} catch (error) {
26+
res.status(500).json({ error: "Error subscribing to the newsletter" });
27+
}
28+
}

src/pages/home/index.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { AboutCommunity, HeroSection } from "@/components";
22
import FaqAccordion from "@/components/FaqAccordion";
33
import Footer from "@/components/Footer";
44
import Cards from "@/components/HomePage/Events_Cards";
5+
import Letter from "@/components/Letter";
56
import Navbar from "@/components/Navbar";
67
import ScrollToTop from "@/components/ScrollToTop";
78
import TestimonialCarousel from "@/components/testimonial";
@@ -36,6 +37,7 @@ const Home = () => {
3637
<Cards />
3738
<TestimonialCarousel />
3839
<FaqAccordion />
40+
<Letter />
3941
<Footer />
4042
</>
4143
)}

0 commit comments

Comments
 (0)