From ca8e643503bad7627f5a598ce9fedfc2fa6e52b5 Mon Sep 17 00:00:00 2001
From: dorian melenotte
Date: Wed, 7 Aug 2024 15:47:57 +0200
Subject: [PATCH] UPDATE: keep the navbar in all the web site
---
src/files/Accueil.jsx | 4 ---
src/files/Root.jsx | 15 ++++++++++
src/main.jsx | 1 +
src/services/Router.jsx | 65 +++++++++++++++++++++++------------------
4 files changed, 52 insertions(+), 33 deletions(-)
create mode 100644 src/files/Root.jsx
diff --git a/src/files/Accueil.jsx b/src/files/Accueil.jsx
index fcee8cb..bedd03a 100644
--- a/src/files/Accueil.jsx
+++ b/src/files/Accueil.jsx
@@ -1,14 +1,10 @@
-import { Navbar } from ".././component/Navbar.jsx";
import { App } from "../component/App.jsx";
import { Body } from "../component/Body.jsx";
import { Footer } from "../component/Footer.jsx";
-import { Header } from "../component/Head.jsx";
export function Accueil() {
return (
<>
-
-
diff --git a/src/files/Root.jsx b/src/files/Root.jsx
new file mode 100644
index 0000000..c13e609
--- /dev/null
+++ b/src/files/Root.jsx
@@ -0,0 +1,15 @@
+import { Outlet, useLocation } from "react-router-dom";
+import { Header } from "../component/Head";
+import { Navbar } from "../component/Navbar";
+
+export function Root() {
+ const location = useLocation();
+ console.log(location);
+ return (
+ <>
+ {location.pathname == "/accueil" && }
+ ;
+
+ >
+ );
+}
diff --git a/src/main.jsx b/src/main.jsx
index 2a3c787..bebed21 100644
--- a/src/main.jsx
+++ b/src/main.jsx
@@ -3,6 +3,7 @@ import React from "react";
import ReactDOM from "react-dom/client";
import { RouterProvider } from "react-router-dom";
import back_img from "./assets/img_site.jpg";
+import { Header } from "./component/Head.jsx";
import { router } from "./services/Router.jsx";
/* function button_caller(argv) {
diff --git a/src/services/Router.jsx b/src/services/Router.jsx
index 8b89bd5..e4d9bdf 100644
--- a/src/services/Router.jsx
+++ b/src/services/Router.jsx
@@ -5,40 +5,47 @@ import { Blog } from "../files/Blog";
import { Help } from "../files/Help";
import { Product } from "../files/Product";
import { Register } from "../files/Register";
+import { Root } from "../files/Root";
import { Serveurs } from "../files/Serveurs";
import { SignIn } from "../files/Sign_in";
export const router = createBrowserRouter([
{
path: "/",
- element: ,
- },
- {
- path: "/sign-in",
- element: ,
- },
- {
- path: "/register",
- element: ,
- },
- {
- path: "/about",
- element: ,
- },
- {
- path: "/blog",
- element: ,
- },
- {
- path: "/help",
- element: ,
- },
- {
- path: "/product",
- element: ,
- },
- {
- path: "/serveurs",
- element: ,
+ element: ,
+ children: [
+ {
+ path: "/accueil",
+ element: ,
+ },
+ {
+ path: "/sign-in",
+ element: ,
+ },
+ {
+ path: "/register",
+ element: ,
+ },
+ {
+ path: "/about",
+ element: ,
+ },
+ {
+ path: "/blog",
+ element: ,
+ },
+ {
+ path: "/help",
+ element: ,
+ },
+ {
+ path: "/product",
+ element: ,
+ },
+ {
+ path: "/serveurs",
+ element: ,
+ },
+ ],
},
]);