From bdd220d2d699d4f59fe80ae4b73b47689e19a3e4 Mon Sep 17 00:00:00 2001 From: VJS Pranavasri Date: Sun, 5 Nov 2023 10:14:53 +0530 Subject: [PATCH] Improvise Dynamic Routing (#320) * Implement Dynamic Routing * wref: https://github.com/vjspranav/StagBin/commit/efb6317cd4b0760356a380cc6d83e6d2e01a476f Signed-off-by: vjspranav * Improve isSplash conditional rendering Signed-off-by: vjspranav * Fix deploy preview --------- Signed-off-by: vjspranav --- public/404.html | 50 +++++++++++ public/index.html | 28 +++++++ src/containers/Main.js | 184 ++++++++++++++--------------------------- 3 files changed, 139 insertions(+), 123 deletions(-) create mode 100644 public/404.html diff --git a/public/404.html b/public/404.html new file mode 100644 index 000000000..391c49c44 --- /dev/null +++ b/public/404.html @@ -0,0 +1,50 @@ + + + + + Single Page Apps for GitHub Pages + + + + diff --git a/public/index.html b/public/index.html index 6464dc1d5..6f6a70363 100644 --- a/public/index.html +++ b/public/index.html @@ -78,6 +78,34 @@ Learn how to configure a non-root public URL by running `npm run build`. --> Ashutosh's Portfolio + diff --git a/src/containers/Main.js b/src/containers/Main.js index 3beef6b00..b74ed81a2 100644 --- a/src/containers/Main.js +++ b/src/containers/Main.js @@ -1,5 +1,5 @@ import React, { Component } from "react"; -import { Route, Switch, HashRouter } from "react-router-dom"; +import { Route, Switch, BrowserRouter } from "react-router-dom"; import Home from "../pages/home/HomeComponent"; import Splash from "../pages/splash/Splash"; import Education from "../pages/education/EducationComponent"; @@ -12,127 +12,65 @@ import Error404 from "../pages/errors/error404/Error"; export default class Main extends Component { render() { - if (settings.isSplash) { - return ( -
- - - ( - - )} - /> - } - /> - ( - - )} - /> - ( - - )} - /> - ( - - )} - /> - ( - - )} - /> - ( - - )} - /> - ( - - )} - /> - ( - - )} - /> - - -
- ); - } else { - return ( -
- - - } - /> - } - /> - ( - - )} - /> - ( - - )} - /> - ( - - )} - /> - ( - - )} - /> - {/* ( - - )} - /> */} - ( - - )} - /> - - -
- ); - } + return ( + + + + settings.isSplash ? ( + + ) : ( + + ) + } + /> + } + /> + ( + + )} + /> + ( + + )} + /> + ( + + )} + /> + } + /> + + {settings.isSplash && ( + } + /> + )} + + } + /> + } + /> + + + ); } }