diff --git a/src/pages/ServerDetails/ServerDetails.jsx b/src/pages/ServerDetails/ServerDetails.jsx index f037f79..9d10b65 100644 --- a/src/pages/ServerDetails/ServerDetails.jsx +++ b/src/pages/ServerDetails/ServerDetails.jsx @@ -1,4 +1,4 @@ -import { useParams, Route, Routes } from 'react-router-dom'; +import { useParams, Route, Routes, NavLink } from 'react-router-dom'; import { useState, useEffect } from 'react'; import Navbar from '../../components/navbar/Navbar'; import ServerProperties from '../ServerProperties/ServerProperties'; @@ -10,91 +10,99 @@ import ServerHistory from '../ServerHistory/ServerHistory'; // import ServerAccess from '../ServerAccess/ServerAccess'; import styles from './ServerDetails.module.scss'; import PropTypes from "prop-types"; -import { FaServer, FaCogs, FaUserFriends, FaGlobe, FaHistory, FaClipboardList, FaSave, FaLock } from 'react-icons/fa'; +import { FaCogs, FaUserFriends, FaGlobe, FaHistory, FaClipboardList, FaSave, FaLock } from 'react-icons/fa'; +import { TbArrowBackUp } from 'react-icons/tb'; +import { FiChevronsLeft,FiChevronsRight } from "react-icons/fi"; import NotFoundPage from '../NotFoundPage/NotFoundPage'; -import { NavLink } from 'react-router-dom'; import { useLocation } from 'react-router-dom'; -const ServerDetails = ({ user }) => { +const ServerDetails = ({ user }) => { const { serverName } = useParams(); const location = useLocation(); const initialStatus = location.state?.status || false; const [status, setStatus] = useState(initialStatus); - + const [isSidebarCollapsed, setIsSidebarCollapsed] = useState(false); useEffect(() => { if (location.state?.status !== undefined) { setStatus(location.state.status); } }, [location]); - + + const handleSidebarToggle = () => { + setIsSidebarCollapsed(!isSidebarCollapsed); + }; + return ( <> -
-
-
- - Retour aux serveurs - - +
+
+
+
+ {isSidebarCollapsed ? : } +
isActive ? `${styles.menuItem} ${styles.active}` : styles.menuItem}> - Propriétés + {!isSidebarCollapsed && 'Propriétés'} isActive ? `${styles.menuItem} ${styles.active}` : styles.menuItem}> - Console + {!isSidebarCollapsed && 'Console'} isActive ? `${styles.menuItem} ${styles.active}` : styles.menuItem}> - Historique + {!isSidebarCollapsed && 'Historique'} isActive ? `${styles.menuItem} ${styles.active}` : styles.menuItem}> - Joueurs + {!isSidebarCollapsed && 'Joueurs'} isActive ? `${styles.menuItem} ${styles.active}` : styles.menuItem}> - Mondes + {!isSidebarCollapsed && 'Mondes'} isActive ? `${styles.menuItem} ${styles.active}` : styles.menuItem}> - Sauvegardes + {!isSidebarCollapsed && 'Sauvegardes'} isActive ? `${styles.menuItem} ${styles.active}` : styles.menuItem}> - Accès + {!isSidebarCollapsed && 'Accès'} + + + + {!isSidebarCollapsed && 'Dashboard'}
- - } /> - } /> - } /> - Cette fonctionnalité sera prochainement disponible.} /> - Cette fonctionnalité sera prochainement disponible.} /> - Cette fonctionnalité sera prochainement disponible.} /> - Cette fonctionnalité sera prochainement disponible.} /> - } /> - + + } /> + } /> + } /> + Cette fonctionnalité sera prochainement disponible.} /> + Cette fonctionnalité sera prochainement disponible.} /> + Cette fonctionnalité sera prochainement disponible.} /> + Cette fonctionnalité sera prochainement disponible.} /> + } /> +
diff --git a/src/pages/ServerDetails/ServerDetails.module.scss b/src/pages/ServerDetails/ServerDetails.module.scss index f721492..74b622c 100644 --- a/src/pages/ServerDetails/ServerDetails.module.scss +++ b/src/pages/ServerDetails/ServerDetails.module.scss @@ -1,6 +1,7 @@ .container { display: flex; min-height: calc(100vh - var(--navbar-height)); + transition: margin-left 0.3s; } .sidebar { @@ -13,15 +14,27 @@ height: calc(100vh - var(--navbar-height)); top: var(--navbar-height); color: white; + transition: width 0.3s; +} + +.sidebar.collapsed { + width: 4rem; +} + +.menu { + display: flex; + flex-direction: column; + justify-content: flex-center; + margin-top: 3rem; } .menuItem { display: flex; align-items: center; - padding: 0.7rem 1rem ; + padding: 0.7rem 1rem; margin: .8rem 0rem; padding-right: 0rem; - font-size: 1.5rem; + font-size: 1.25rem; cursor: pointer; color: #D1D5DB; text-decoration: none; @@ -32,42 +45,29 @@ } } -.menuItem:hover { - color: white; -} - - -.user { - margin-bottom: 2rem; -} - -.user p { - font-size: 1.25rem; - font-weight: bold; -} - -.user small { - font-size: 0.875rem; - color: #9CA3AF; -} - -.menu { - display: flex; - flex-direction: column; - justify-content: space-around; - margin-top: 2.5rem; -} - - .menuItem:hover { color: white; } .menuItem svg { margin-right: 1rem; - font-size: 1.25rem; + font-size: 1.8rem; } +.toggleButton { + display: flex; + align-items: center; + justify-content: center; + font-size: 2rem; + color: white; + background-color: #100D25; + border: none; + cursor: pointer; + transition: background-color 0.3s; + margin: 0; + right: 0; + margin-bottom: 1rem; +} .serverDetailsContainer { margin-top: var(--navbar-height); @@ -83,22 +83,6 @@ overflow-y: auto; } - -.navbar { - position: fixed; - top: 0; - left: 0; - width: 100%; - height: var(--navbar-height); - background-color: var(--navbar-bg-color); - z-index: 1000; - box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); +.container.collapsed .serverDetailsContainer { + margin-left: 5rem; // largeur mode rétracté } - -.userinfo { - display: flex; - align-items: start; - justify-content: center; - flex-direction: column; - margin-left: 1rem; -} \ No newline at end of file