UPDATE: keep the navbar in all the web site

This commit is contained in:
dorian melenotte 2024-08-07 15:47:57 +02:00
parent ef227551c7
commit ca8e643503
4 changed files with 52 additions and 33 deletions

View File

@ -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 (
<>
<Navbar />
<Header />
<App />
<Body />
<Footer />

15
src/files/Root.jsx Normal file
View File

@ -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" && <Navbar />}
<Header />;
<Outlet />
</>
);
}

View File

@ -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) {

View File

@ -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: <Accueil />,
},
{
path: "/sign-in",
element: <SignIn />,
},
{
path: "/register",
element: <Register />,
},
{
path: "/about",
element: <About />,
},
{
path: "/blog",
element: <Blog />,
},
{
path: "/help",
element: <Help />,
},
{
path: "/product",
element: <Product />,
},
{
path: "/serveurs",
element: <Serveurs />,
element: <Root />,
children: [
{
path: "/accueil",
element: <Accueil />,
},
{
path: "/sign-in",
element: <SignIn />,
},
{
path: "/register",
element: <Register />,
},
{
path: "/about",
element: <About />,
},
{
path: "/blog",
element: <Blog />,
},
{
path: "/help",
element: <Help />,
},
{
path: "/product",
element: <Product />,
},
{
path: "/serveurs",
element: <Serveurs />,
},
],
},
]);