Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: error 404 component added #172

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 13 additions & 27 deletions client/src/App.js
Original file line number Diff line number Diff line change
@@ -1,44 +1,30 @@

import "react-toastify/dist/ReactToastify.css";
import { useState } from "react";
import "./App.css";
import Home from "./Components/Home";
import { Route, Routes } from "react-router-dom";
import { ToastContainer, toast } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";
import { Routes, Route } from "react-router-dom";
import ErrorPage from "./Components/404";
import SendNewsFeed from "./Components/SendNewsFeed";
import Login from "./Components/Login";

function App() {


const [loading, setLoading] = useState(true);
const spinner = document.getElementById("spinner");
if (spinner) {
setTimeout(() => {
spinner.style.display = "none";

}, 2000);
}


return (
<Routes>
<Route path="/" element={<>
<Home />
<ToastContainer
position="top-center"
autoClose={5000}
hideProgressBar={false}
newestOnTop={false}
closeOnClick
rtl={false}
pauseOnFocusLoss
draggable
pauseOnHover
theme="light"
/></>}/>
<Route path='/sendNews' element={<SendNewsFeed/>}/>
<Route path='/login' element={<Login/>}/>
</Routes>
!loading && <div>
<Routes>
<Route path="/" element={<Home/>}/>
<Route path='/sendNews' element={<SendNewsFeed/>}/>
<Route path='/login' element={<Login/>}/>
<Route path="*" element={<ErrorPage/>}/>
</Routes>
</div>
);
}

Expand Down
Binary file added client/src/Assets/error404.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions client/src/CSS/404.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.error{
display: flex;
justify-content: center;
text-align: center;
}
14 changes: 14 additions & 0 deletions client/src/Components/404.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from "react";
import "../CSS/404.css"
import error404 from "../Assets/error404.png"

const ErrorPage = () => {
return(

<div className="error">
<img src={error404}></img>
</div>
)
}

export default ErrorPage;
15 changes: 15 additions & 0 deletions client/src/Components/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,25 @@ import Testimonials from "./Testimonials";
import Images from "./Image";
import "../CSS/MediaQuery.css";
import Faq from "./Faq";
import { ToastContainer } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";
import React, { useState } from "react";

const Home = () => {
return (
<div>
<ToastContainer
position="top-center"
autoClose={5000}
hideProgressBar={false}
newestOnTop={false}
closeOnClick
rtl={false}
pauseOnFocusLoss
draggable
pauseOnHover
theme="light"
/>
<Helmet>
<title>DevFeed</title>
</Helmet>
Expand Down
1 change: 1 addition & 0 deletions client/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
import './index.css';
import App from './App';
import {BrowserRouter} from "react-router-dom";
Expand Down