diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..89d2f6e --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +**/.env +**/.DS_Store +**/node_modules \ No newline at end of file diff --git a/my-app/src/App.jsx b/my-app/src/App.jsx index c2cd1ae..dec0871 100644 --- a/my-app/src/App.jsx +++ b/my-app/src/App.jsx @@ -6,15 +6,24 @@ import Community from "./pages/Community"; import ContactForm from "./pages/Contact"; import Events from "./pages/Events"; import Base from "./layouts/Base"; +import Subscribe from "./components/Subscribe"; +import { useState } from "react"; export default function App() { + const [isVisible, setIsVisible] = useState(false); + + const handleSetVisible = (value)=>{ + setIsVisible(value); + }; + return (
+ {isVisible&&} - } /> - } /> + } /> + } /> } /> } /> } /> diff --git a/my-app/src/components/Newsletter.jsx b/my-app/src/components/Newsletter.jsx index 719a6fe..5b22f7e 100644 --- a/my-app/src/components/Newsletter.jsx +++ b/my-app/src/components/Newsletter.jsx @@ -1,24 +1,23 @@ import React from "react"; -import siteConfig from "../site.config"; -export default function Newsletter() { +export default function Newsletter(props) { return ( + <>

Join our monthly newsletter

- props.handle(true)} > Subscribe - +
+ ); } diff --git a/my-app/src/components/Subscribe.jsx b/my-app/src/components/Subscribe.jsx new file mode 100644 index 0000000..067372a --- /dev/null +++ b/my-app/src/components/Subscribe.jsx @@ -0,0 +1,128 @@ +import React, { useState } from 'react' +import Toastify from "toastify-js"; +import "toastify-js/src/toastify.css"; +import { RxCross2 } from "react-icons/rx"; +import {motion} from "framer-motion"; +import { API_URL } from '../lib/constants'; + +const Subscribe = (props) => { + const [name, setName] = useState(""); + const [email, setEmail] = useState(""); + const [reg, setReg] = useState(""); + + const handleSend = async () => { + if (name === "" || email === "" || reg === "") { + Toastify({ + text: "Form can't be empty!", + duration: 3000, + backgroundColor: "#56ccf2", + stopOnFocus: true, + position: "right", + }).showToast(); + return; + } + + try { + const response = await fetch(`${API_URL}/subscribe/subscribe`, { + method: "POST", + body: JSON.stringify({ + name: name, + email: email, + reg: reg, + }), + headers: { + "Content-type": "application/json; charset=UTF-8", + }, + }); + + if (response.status === 200) { + const result = await response.json(); // Assuming the response is in JSON format + Toastify({ + text: result.message || "Subscription successful!", // Adjust according to your API response + duration: 3000, + backgroundColor: "#56ccf2", + stopOnFocus: true, + position: "right", + }).showToast(); + setName(""); + setEmail(""); + setReg(""); + props.handle(false); + } else { + Toastify({ + text: "Something went wrong!", + duration: 3000, + backgroundColor: "#ff0000", + stopOnFocus: true, + position: "right", + }).showToast(); + } + } catch (err) { + console.error(err); + Toastify({ + text: "An error occurred!", + duration: 3000, + backgroundColor: "#ff0000", + stopOnFocus: true, + position: "right", + }).showToast(); + } + }; + + + return ( +
+ +
+ props.handle(false)} size={32} className="cursor-pointer hover:scale-[1.2] a" /> +
+

Subscribe to Our Newsletter

+
+ + + + +
+
+
+ ) +} + +export default Subscribe \ No newline at end of file diff --git a/my-app/src/index.css b/my-app/src/index.css index 79fd97e..15c52fd 100644 --- a/my-app/src/index.css +++ b/my-app/src/index.css @@ -11,6 +11,23 @@ body{ background-color: #0d1026 } +.a{ + transition: all 0.4s; +} + +html { + overflow: scroll; + overflow-x: hidden; +} +::-webkit-scrollbar { + width: 0; /* Remove scrollbar space */ + background: transparent; /* Optional: just make scrollbar invisible */ +} +/* Optional: show position indicator in red */ +::-webkit-scrollbar-thumb { + background: #131313; +} + @tailwind components; @tailwind utilities; diff --git a/my-app/src/pages/About.jsx b/my-app/src/pages/About.jsx index f2ff839..634c6b3 100644 --- a/my-app/src/pages/About.jsx +++ b/my-app/src/pages/About.jsx @@ -1,8 +1,7 @@ import React from "react"; import GroupMembers from "../assets/images/about2.png"; -import siteConfig from "../site.config"; -const About = () => { +const About = (props) => { return (
diff --git a/my-app/src/pages/Home.jsx b/my-app/src/pages/Home.jsx index 099385e..2df513f 100644 --- a/my-app/src/pages/Home.jsx +++ b/my-app/src/pages/Home.jsx @@ -4,13 +4,13 @@ import Newsletter from "../components/Newsletter"; import Statistics from "../components/Statistics"; import Testimonial from "../components/Testimonial"; -const Home = () => { +const Home = (props) => { return ( <> - + ); }; diff --git a/my-app/src/site.config.js b/my-app/src/site.config.js index 6aa5337..9c075a3 100644 --- a/my-app/src/site.config.js +++ b/my-app/src/site.config.js @@ -15,9 +15,9 @@ const siteConfig = { titleTemplate: "%s - Codex", description: shared.description, stats: { - members: 100, - commits: 2.1, - projects: 35, + members: 120, + commits: 2.3, + projects: 38, workshops: 18, }, newsletterUrl: "https://docs.google.com/forms/d/e/1FAIpQLSdOp_wsPsjwFvxhSRECAxBsUGeL2s4cjJ1SghNLgNPg7f8bHQ/viewform", diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..a8a227f --- /dev/null +++ b/package-lock.json @@ -0,0 +1,54 @@ +{ + "name": "website-frontend", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "react-icons": "^5.3.0" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "license": "MIT", + "peer": true + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "license": "MIT", + "peer": true, + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, + "node_modules/react": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", + "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "loose-envify": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-icons": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-5.3.0.tgz", + "integrity": "sha512-DnUk8aFbTyQPSkCfF8dbX6kQjXA9DktMeJqfjrg6cK9vwQVMxmcA3BfP4QoiztVmEHtwlTgLFsPuH2NskKT6eg==", + "license": "MIT", + "peerDependencies": { + "react": "*" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..644e5da --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "react-icons": "^5.3.0" + } +}