diff --git a/web/src/app/home/components/home-sidebar/HomeSidebar.module.css b/web/src/app/home/components/home-sidebar/HomeSidebar.module.css index c1ac4ff8..5cf2a505 100644 --- a/web/src/app/home/components/home-sidebar/HomeSidebar.module.css +++ b/web/src/app/home/components/home-sidebar/HomeSidebar.module.css @@ -8,6 +8,7 @@ align-items: flex-start; justify-content: space-between; padding-block: 1rem; + padding-left: 0.4rem; user-select: none; /* box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.1); */ } @@ -54,13 +55,18 @@ flex-direction: column; align-items: center; justify-content: center; - gap: 0.5rem; + gap: 0.8rem; +} + +.sidebarItemsContainer { + display: flex; + flex-direction: column; + gap: 0.8rem; } .sidebarChildContainer { width: 9rem; height: 3rem; - margin: 0.8rem 0; padding-left: 1.6rem; font-size: 1rem; border-radius: 12px; @@ -70,6 +76,7 @@ justify-content: flex-start; cursor: pointer; gap: 0.5rem; + /* background-color: aqua; */ } .sidebarSelected { @@ -90,11 +97,12 @@ .sidebarBottomContainer { width: 100%; - height: 100px; display: flex; flex-direction: column; align-items: center; justify-content: center; + margin-top: auto; + padding-bottom: 1rem; } .sidebarBottomChildContainer { diff --git a/web/src/app/home/components/home-sidebar/HomeSidebar.tsx b/web/src/app/home/components/home-sidebar/HomeSidebar.tsx index d9752c3a..ff3edc47 100644 --- a/web/src/app/home/components/home-sidebar/HomeSidebar.tsx +++ b/web/src/app/home/components/home-sidebar/HomeSidebar.tsx @@ -30,6 +30,10 @@ export default function HomeSidebar({ useEffect(() => { console.log('HomeSidebar挂载完成'); initSelect(); + if (!localStorage.getItem('token')) { + localStorage.setItem('token', 'test-token'); + localStorage.setItem('userEmail', 'test@example.com'); + } return () => console.log('HomeSidebar卸载'); // eslint-disable-next-line react-hooks/exhaustive-deps }, []); @@ -77,6 +81,12 @@ export default function HomeSidebar({ } } + function handleLogout() { + localStorage.removeItem('token'); + localStorage.removeItem('userEmail'); + window.location.href = '/login'; + } + return (