This commit is contained in:
2026-01-09 20:25:01 +03:00
parent eecb02b82a
commit eda8b512f5
2 changed files with 1 additions and 17 deletions

View File

@ -1,4 +1,3 @@
// src/App.jsx
import React from "react"; import React from "react";
import { BrowserRouter, Routes, Route, useLocation } from "react-router-dom"; import { BrowserRouter, Routes, Route, useLocation } from "react-router-dom";
import { AnimatePresence, LayoutGroup } from "framer-motion"; import { AnimatePresence, LayoutGroup } from "framer-motion";
@ -16,7 +15,6 @@ import Contact from "./Components/Sections/Contact/Contact";
import Footer from "./Components/Nav/Footer"; import Footer from "./Components/Nav/Footer";
import DepartmentDetail2 from "./Components/Sections/DepartmentDetail2/DepartmentDetail2"; import DepartmentDetail2 from "./Components/Sections/DepartmentDetail2/DepartmentDetail2";
/* MainPage — الصفحة التي تحتوي على الأقسام المجمعة (لا تتضمن Navbar هنا) */
const MainPage = () => { const MainPage = () => {
return ( return (
<div className="min-h-screen bg-white dark:bg-gray-900 text-gray-900 dark:text-white transition-colors duration-300"> <div className="min-h-screen bg-white dark:bg-gray-900 text-gray-900 dark:text-white transition-colors duration-300">
@ -34,7 +32,6 @@ const MainPage = () => {
); );
}; };
/* Router view يستخدم useLocation مع AnimatePresence */
function RouterView() { function RouterView() {
const location = useLocation(); const location = useLocation();
@ -45,24 +42,19 @@ function RouterView() {
<Route path="/" element={<MainPage />} /> <Route path="/" element={<MainPage />} />
<Route path="/departments/:id" element={<DepartmentDetail />} /> <Route path="/departments/:id" element={<DepartmentDetail />} />
<Route path="/department-detail2" element={<DepartmentDetail2 />} /> <Route path="/department-detail2" element={<DepartmentDetail2 />} />
{/* أضف مسارات إضافية هنا إذا احتجت */}
</Routes> </Routes>
</AnimatePresence> </AnimatePresence>
</LayoutGroup> </LayoutGroup>
); );
} }
/* Layout: يقرر متى يُعرض الـ Navbar بناءً على الـ pathname */
function Layout() { function Layout() {
const location = useLocation(); const location = useLocation();
// هنا ضع المسارات أو الأنماط التي تريد إخفاء الـ Navbar فيها
const excludedExactPaths = [ const excludedExactPaths = [
"/department-detail2", "/department-detail2",
// أضف مسارات أخرى تريد إخفاء navbar فيها بنفس الشكل
]; ];
// أمثلة على أنماط: إخفاء لكل ما يبدأ بـ /departments/
const excludedPrefixes = ["/departments/"]; const excludedPrefixes = ["/departments/"];
const isExcludedExact = excludedExactPaths.includes(location.pathname); const isExcludedExact = excludedExactPaths.includes(location.pathname);
@ -70,15 +62,12 @@ function Layout() {
const hideNavbar = isExcludedExact || isExcludedPrefix; const hideNavbar = isExcludedExact || isExcludedPrefix;
// ارتفاع الـ Navbar المستخدم كـ padding-top عندما يكون ظاهرًا (يتوافق مع height في Navbar.jsx)
const navbarHeight = hideNavbar ? 0 : 56; const navbarHeight = hideNavbar ? 0 : 56;
return ( return (
<> <>
{/* Navbar يظهر فقط عندما hideNavbar === false */}
{!hideNavbar && <Navbar />} {!hideNavbar && <Navbar />}
{/* نضع الـ RouterView داخل حاوية لها padding-top مساوٍ لارتفاع الـ navbar عند ظهوره */}
<div style={{ paddingTop: navbarHeight }}> <div style={{ paddingTop: navbarHeight }}>
<RouterView /> <RouterView />
</div> </div>

View File

@ -9,7 +9,6 @@ import {
} from "framer-motion"; } from "framer-motion";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
// images
import d1 from "../../../../src/assets/Images/d1.jpeg"; import d1 from "../../../../src/assets/Images/d1.jpeg";
import d7 from "../../../../src/assets/Images/d7.jpeg"; import d7 from "../../../../src/assets/Images/d7.jpeg";
import d14 from "../../../../src/assets/Images/d14.jpg"; import d14 from "../../../../src/assets/Images/d14.jpg";
@ -20,9 +19,6 @@ import d20 from "../../../../src/assets/Images/d20.jpeg";
import d21 from "../../../../src/assets/Images/d21.jpeg"; import d21 from "../../../../src/assets/Images/d21.jpeg";
import d22 from "../../../../src/assets/Images/d22.jpg"; import d22 from "../../../../src/assets/Images/d22.jpg";
const departments = [ const departments = [
{ id: 1, title: "قسم إنشاء وصيانة المنشآت الصناعية وخطوط الإنتاج", image: d1 }, { id: 1, title: "قسم إنشاء وصيانة المنشآت الصناعية وخطوط الإنتاج", image: d1 },
{ id: 2, title: "قسم تنفيذ المرافق السكنية والخدمية", image: d7 }, { id: 2, title: "قسم تنفيذ المرافق السكنية والخدمية", image: d7 },
@ -33,7 +29,6 @@ const departments = [
{ id: 7, title: "قسم الاعمال المعدنية والدعم الصناعي", image: d20 }, { id: 7, title: "قسم الاعمال المعدنية والدعم الصناعي", image: d20 },
{ id: 8, title: "قسم الخدمات والدعم اللوجستي", image: d21 }, { id: 8, title: "قسم الخدمات والدعم اللوجستي", image: d21 },
{ id: 9, title: "قسم الاتمتة والتحكم", image: d22 }, { id: 9, title: "قسم الاتمتة والتحكم", image: d22 },
]; ];
function DepartmentCard({ dept, offset }) { function DepartmentCard({ dept, offset }) {
@ -143,7 +138,7 @@ export default function Departments() {
return ( return (
<section className="min-h-screen bg-white text-black" dir="rtl"> <section className="min-h-screen bg-white text-black" dir="rtl">
<header className="max-w-6xl mx-auto px-6 pt-12"> <header className="max-w-6xl mx-auto px-6 pt-12">
<h1 className="text-4xl font-extrabold">أقسامنا</h1> <h1 className="text-5xl font-extrabold text-transparent bg-clip-text bg-gradient-to-r from-orange-400 via-orange-500 to-orange-600">أقسامنا</h1>
</header> </header>
<main className="max-w-6xl mx-auto px-6 py-20"> <main className="max-w-6xl mx-auto px-6 py-20">