Added toast notifications

This commit is contained in:
Keannu Christian Bernasol 2023-11-13 22:46:14 +08:00
parent fd4c2e9ad6
commit 0cccaf25f1
5 changed files with 52 additions and 9 deletions

View file

@ -4,9 +4,9 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { Provider } from "react-redux";
import "./App.css";
import store from "./Components/Plugins/Redux/Store/Store";
const queryClient = new QueryClient();
import { ToastContainer } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";
const router = createHashRouter([
{
path: "/",
@ -21,6 +21,15 @@ export default function App() {
<QueryClientProvider client={queryClient}>
<RouterProvider router={router} />
</QueryClientProvider>
<ToastContainer
autoClose={1500}
position="bottom-center"
closeOnClick
pauseOnHover
draggable
theme={"light"}
limit={3}
/>
</Provider>
);
}

View file

@ -13,10 +13,10 @@ export default function Button(props: props) {
return (
<div>
<button
onClick={props.onClick}
onMouseDown={() => {
if (!clicked) {
props.onClick;
setClicked(true);
setClicked(!clicked);
}
}}
onMouseUp={() => setClicked(false)}

View file

@ -1,6 +1,7 @@
import Button from "../../Components/Buttons/Button";
import styles from "../../Components/styles";
import citc_logo from "../../assets/citc_logo.jpg";
import { toast } from "react-toastify";
export default function LandingPage() {
return (
<div style={styles.background}>
@ -45,13 +46,24 @@ export default function LandingPage() {
TRACKER
</p>
<div style={{ ...styles.flex_column }}>
<Button type={"light"} label={"Login"} onClick={() => {}} />
<Button type={"dark"} label={"Register"} onClick={() => {}} />
<Button
type={"light"}
label={"Login"}
onClick={() => {
toast("Successfully logged in!");
}}
/>
<Button
type={"dark"}
label={"Register"}
onClick={() => {
toast("Redirecting!");
}}
/>
</div>
</div>
</div>
</div>
<p>heh</p>
</div>
);
}