Skip to content

Commit

Permalink
added toaster
Browse files Browse the repository at this point in the history
  • Loading branch information
devprashantt committed Aug 8, 2022
1 parent a70e5d9 commit 34655e0
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 8 deletions.
37 changes: 36 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"react-dom": "^17.0.2",
"react-router-dom": "^6.2.1",
"react-scripts": "^5.0.1",
"react-toastify": "^9.0.7",
"react-toastify": "^9.0.8",
"sass": "^1.49.9",
"web-vitals": "^2.1.4"
},
Expand Down
2 changes: 0 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { BrowserRouter as Router, Route, Routes } from "react-router-dom";

import Home from "./pages/Home/Home";
import Navbar from "./components/Navbar/Navbar";
import Teams from "./pages/Team/Teams";

function App() {

return (
<Router>
<Navbar />
<Routes>
<Route path="/" exact element={<Home />} />
<Route path="/teams" exact element={<Teams />} />
Expand Down
2 changes: 2 additions & 0 deletions src/pages/Home/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import Events from "./components/Events/Events";
import JoinCommunity from "./components/JoinCommunity/JoinCommunity";
import Footer from "./components/Footer/Footer";
import Gallery from "./components/Gallery/Gallery";
import Navbar from "../../components/Navbar/Navbar";

const Home = () => {
return (
<div className="home">
<Navbar />
<Title />
<About />
<Moto />
Expand Down
12 changes: 8 additions & 4 deletions src/pages/Home/components/JoinCommunity/JoinCommunity.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ import axios from "axios";
import { ToastContainer, toast } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";

import CalendarSVG from "../../../../assets/illustrations/calendar.svg";
import CommunitySVG from "../../../../assets/illustrations/community.svg";

const secretKey = process.env.SECRET

const JoinCommunity = () => {
const [input, setInput] = useState(false);
const [input, setInput] = useState(" ");

const notify = () =>
toast("Subscribed Successfully", {
Expand All @@ -38,7 +37,10 @@ const JoinCommunity = () => {
}
)
.then((res) => {
console.log(res);
if (res.status === 200 || res.status === 201 || res.status === 202) {
notify();
setInput("");
}
})
.catch((err) => {
console.log(err);
Expand All @@ -59,14 +61,16 @@ const JoinCommunity = () => {
</div>
<div className="input-box">
<input
id="mainInput"
type="email"
placeholder="Your work email address"
onChange={(e) => {
e.preventDefault();
setInput(e.target.value);
}}
/>
<button onClick={handleInput}>Subscribe</button>
<button type="submit" onClick={handleInput}>Subscribe</button>
<ToastContainer />
</div>
</div>
</div>
Expand Down

1 comment on commit 34655e0

@vercel
Copy link

@vercel vercel bot commented on 34655e0 Aug 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.