From 0e29b3037c0d3c112c804ca94ca9c5aa7700113b Mon Sep 17 00:00:00 2001 From: siddheshmorewdi Date: Mon, 15 Apr 2024 17:34:32 +0530 Subject: [PATCH 1/3] Routes refactored --- src/App.jsx | 122 +---------------- src/Layout/DefaultLayout.jsx | 15 ++ .../ArticleInternalFour.jsx | 2 +- .../ArticleInternalOne/ArticleInternalOne.jsx | 1 - .../ArticleInternalSix/ArticleInternalSix.jsx | 2 +- .../ArticleInternalThree.jsx | 2 +- .../ArticleInternalTwo/ArticleInternalTwo.jsx | 2 +- .../ArticleInternalfive.jsx | 7 +- src/pages/BuildPage.jsx | 1 - src/pages/Community.jsx | 1 - src/pages/Contact.jsx | 1 - src/pages/HomePage.jsx | 2 - src/pages/UseCases.jsx | 1 - src/routes/_routes.jsx | 129 ++++++++++++++++++ 14 files changed, 157 insertions(+), 131 deletions(-) create mode 100644 src/Layout/DefaultLayout.jsx create mode 100644 src/routes/_routes.jsx diff --git a/src/App.jsx b/src/App.jsx index 22a4b68..3426824 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -5,129 +5,19 @@ import { createRoutesFromElements, RouterProvider, } from "react-router-dom"; -import HomePage from "./pages/HomePage"; -import NavBar from "./components/NavBar/NavBar"; -import LearnPage from "./pages/LearnPage"; -import BuildPage from "./pages/BuildPage"; -import Community from "./pages/Community"; -import Contact from "./pages/Contact"; -import UseCases from "./pages/UseCases"; -import ArticleInternalPage from "./components/ArticleInternalPage/ArticleInternalPage"; -import NotFound from "./pages/NotFound"; -import fintech from "../src/assets/images/usecase-bg.png"; -import adTech from "../src/assets/images/addtech.jpg"; -import martech from "../src/assets/images/martech.png"; -import healthTech from "../src/assets/images/health-tech.png"; -import { useCase } from "./data/useCase"; -import ArticleInternalOne from "./components/ArticleInternalOne/ArticleInternalOne"; -import ArticleInternalTwo from "./components/ArticleInternalTwo/ArticleInternalTwo"; -import ArticleInternalThree from "./components/ArticleInternalThree/ArticleInternalThree"; -import ArticleInternalFour from "./components/ArticleInternalFour/ArticleInternalFour"; -import ArticleInternalfive from "./components/ArticleInternalfive/ArticleInternalfive"; -import ArticleInternalSix from "./components/ArticleInternalSix/ArticleInternalSix"; +import { route } from "./routes/_routes"; +import DefaultLayout from "./Layout/DefaultLayout"; const router = createBrowserRouter( createRoutesFromElements( - }> - } /> - } /> - } /> - } /> - } /> - {/* } - /> */} - } - /> - } - /> - } - /> - } - /> - } - /> - } - /> - - } /> - } /> - - } - /> - - - } - /> - - } - /> - - } - /> - + route.map(({ path, element }) => ( + {element}} /> + )) ) ); function App() { - return ( - <> - - - ); + return ; } export default App; diff --git a/src/Layout/DefaultLayout.jsx b/src/Layout/DefaultLayout.jsx new file mode 100644 index 0000000..4fe1237 --- /dev/null +++ b/src/Layout/DefaultLayout.jsx @@ -0,0 +1,15 @@ +import React from "react"; +import NavBar from "../components/NavBar/NavBar"; +import Footer from "../components/Footer/Footer"; + +const DefaultLayout = ({ children }) => { + return ( +
+ + {children} +
+
+ ); +}; + +export default DefaultLayout; diff --git a/src/components/ArticleInternalFour/ArticleInternalFour.jsx b/src/components/ArticleInternalFour/ArticleInternalFour.jsx index d49aaab..b521651 100644 --- a/src/components/ArticleInternalFour/ArticleInternalFour.jsx +++ b/src/components/ArticleInternalFour/ArticleInternalFour.jsx @@ -264,7 +264,7 @@ const ArticleInternalFour = () => { -