From b78438104c4cc5a5999dcff5c99e7a055e1142d2 Mon Sep 17 00:00:00 2001 From: knuthtimo-lab Date: Tue, 16 Sep 2025 14:16:00 +0200 Subject: [PATCH] =?UTF-8?q?Fertig,=20kein=20wei=C3=9Fes=20flickern?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.tsx | 69 ++++++++++++++++++++++++--------------- src/components/Header.tsx | 69 +++++++++++++++++++++++++-------------- src/index.css | 35 +++++++++++++++++++- 3 files changed, 122 insertions(+), 51 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index c86cfc3..fc17753 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -3,43 +3,60 @@ import { Toaster as Sonner } from "@/components/ui/sonner"; import { TooltipProvider } from "@/components/ui/tooltip"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { BrowserRouter, Routes, Route } from "react-router-dom"; -import Index from "./pages/Index"; -import Services from "./pages/Services"; -import About from "./pages/About"; -import ClientsProjects from "./pages/ClientsProjects"; -import Locations from "./pages/Locations"; -import Careers from "./pages/Careers"; -import Contact from "./pages/Contact"; -import Legal from "./pages/Legal"; -import Privacy from "./pages/Privacy"; -import Terms from "./pages/Terms"; -import NotFound from "./pages/NotFound"; +import { Suspense, lazy } from "react"; + +// Lazy load pages for better performance +const Index = lazy(() => import("./pages/Index")); +const Services = lazy(() => import("./pages/Services")); +const About = lazy(() => import("./pages/About")); +const ClientsProjects = lazy(() => import("./pages/ClientsProjects")); +const Locations = lazy(() => import("./pages/Locations")); +const Careers = lazy(() => import("./pages/Careers")); +const Contact = lazy(() => import("./pages/Contact")); +const Legal = lazy(() => import("./pages/Legal")); +const Privacy = lazy(() => import("./pages/Privacy")); +const Terms = lazy(() => import("./pages/Terms")); +const NotFound = lazy(() => import("./pages/NotFound")); const queryClient = new QueryClient(); +// Loading component to prevent white flash +const PageLoader = () => ( +
+
+
+
+
+
+); + const App = () => ( - - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - {/* ADD ALL CUSTOM ROUTES ABOVE THE CATCH-ALL "*" ROUTE */} - } /> - + }> +
+ + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + {/* ADD ALL CUSTOM ROUTES ABOVE THE CATCH-ALL "*" ROUTE */} + } /> + +
+
); -export default App; +export default App; \ No newline at end of file diff --git a/src/components/Header.tsx b/src/components/Header.tsx index 7d5b489..837e157 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -1,10 +1,18 @@ import React from 'react'; +import { Link, useLocation } from 'react-router-dom'; import { Button } from '@/components/ui/button'; import { Menu, X } from 'lucide-react'; import content from '@/content/content.json'; const Header = () => { const [isOpen, setIsOpen] = React.useState(false); + const location = useLocation(); + + // Function to convert nav item to route path + const getRoutePath = (item: string) => { + if (item === 'Home') return '/'; + return `/${item.toLowerCase().replace(/\s+/g, '-').replace('&', 'and')}`; + }; return ( <> @@ -17,9 +25,9 @@ const Header = () => { Professional welding services across Texas — Get your quote today - + Learn more → - + @@ -30,28 +38,34 @@ const Header = () => {
{/* Logo - IIT Logo */} - + IIT Welding - + {/* Desktop Navigation - Dispel Style */} - {/* Mobile Menu Button */}