diff options
| author | Wolfboy248 <georgejvindkarlsen@gmail.com> | 2025-08-26 08:20:51 +0200 |
|---|---|---|
| committer | Wolfboy248 <georgejvindkarlsen@gmail.com> | 2025-08-26 08:20:51 +0200 |
| commit | ddfe5015c9237fbe0fea44f8bcde31708eb3adac (patch) | |
| tree | db7d9812461c0ab0dc39812465f20bc958f9bf67 /frontend/src/components/Sidebar | |
| parent | Moved breadcrum navigation into its own component (diff) | |
| download | lphub-ddfe5015c9237fbe0fea44f8bcde31708eb3adac.tar.gz lphub-ddfe5015c9237fbe0fea44f8bcde31708eb3adac.tar.bz2 lphub-ddfe5015c9237fbe0fea44f8bcde31708eb3adac.zip | |
Fixed some inconsistant styles and fixed category queryparam in maplist pagecss
Diffstat (limited to '')
| -rw-r--r-- | frontend/src/components/Sidebar/Content.tsx | 2 | ||||
| -rw-r--r-- | frontend/src/components/Sidebar/Search.tsx | 9 | ||||
| -rw-r--r-- | frontend/src/components/Sidebar/Sidebar.module.css | 3 | ||||
| -rw-r--r-- | frontend/src/components/Sidebar/Sidebar.tsx | 11 |
4 files changed, 14 insertions, 11 deletions
diff --git a/frontend/src/components/Sidebar/Content.tsx b/frontend/src/components/Sidebar/Content.tsx index ceb9e67..6aade15 100644 --- a/frontend/src/components/Sidebar/Content.tsx +++ b/frontend/src/components/Sidebar/Content.tsx | |||
| @@ -18,7 +18,7 @@ interface ContentProps { | |||
| 18 | const _Content: React.FC<ContentProps> = ({ isSearching, selectedButtonIndex, handle_sidebar_click }) => { | 18 | const _Content: React.FC<ContentProps> = ({ isSearching, selectedButtonIndex, handle_sidebar_click }) => { |
| 19 | 19 | ||
| 20 | return ( | 20 | return ( |
| 21 | <div className="h-full"> | 21 | <div className="md:h-full"> |
| 22 | 22 | ||
| 23 | <div className="px-2 my-2.5"> | 23 | <div className="px-2 my-2.5"> |
| 24 | <button onClick={() => handle_sidebar_click(0)} className={`${styles.button} ${selectedButtonIndex == 0 ? styles["button-selected"] : ""} ${isSearching ? styles["button-hidden"] : ""}`}> | 24 | <button onClick={() => handle_sidebar_click(0)} className={`${styles.button} ${selectedButtonIndex == 0 ? styles["button-selected"] : ""} ${isSearching ? styles["button-hidden"] : ""}`}> |
diff --git a/frontend/src/components/Sidebar/Search.tsx b/frontend/src/components/Sidebar/Search.tsx index 00d9e1e..49bcec7 100644 --- a/frontend/src/components/Sidebar/Search.tsx +++ b/frontend/src/components/Sidebar/Search.tsx | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | import React, { useRef } from "react"; | 1 | import React from "react"; |
| 2 | import { Link } from "react-router-dom"; | 2 | import { Link } from "react-router-dom"; |
| 3 | 3 | ||
| 4 | import { Search } from "@customTypes/Search"; | 4 | import { Search } from "@customTypes/Search"; |
| @@ -7,21 +7,20 @@ import { UserProfile } from "@customTypes/Profile"; | |||
| 7 | 7 | ||
| 8 | interface SearchProps { | 8 | interface SearchProps { |
| 9 | profile?: UserProfile; | 9 | profile?: UserProfile; |
| 10 | searchbarRef: React.RefObject<HTMLInputElement | null>; | ||
| 10 | }; | 11 | }; |
| 11 | 12 | ||
| 12 | const _Search: React.FC<SearchProps> = ({ profile }) => { | 13 | const _Search: React.FC<SearchProps> = ({ profile, searchbarRef }) => { |
| 13 | const [searchData, setSearchData] = React.useState<Search | undefined>( | 14 | const [searchData, setSearchData] = React.useState<Search | undefined>( |
| 14 | undefined | 15 | undefined |
| 15 | ); | 16 | ); |
| 16 | 17 | ||
| 17 | const searchbarRef = useRef<HTMLInputElement>(null); | ||
| 18 | |||
| 19 | const _handle_search_change = async (q: string) => { | 18 | const _handle_search_change = async (q: string) => { |
| 20 | const searchResponse = await API.get_search(q); | 19 | const searchResponse = await API.get_search(q); |
| 21 | setSearchData(searchResponse); | 20 | setSearchData(searchResponse); |
| 22 | }; | 21 | }; |
| 23 | return ( | 22 | return ( |
| 24 | <div className="flex w-full flex-col justify-between p-3"> | 23 | <div className="flex w-full flex-col p-3 not-md:absolute"> |
| 25 | <input | 24 | <input |
| 26 | ref={searchbarRef} | 25 | ref={searchbarRef} |
| 27 | type="text" | 26 | type="text" |
diff --git a/frontend/src/components/Sidebar/Sidebar.module.css b/frontend/src/components/Sidebar/Sidebar.module.css index 9baf415..6e43254 100644 --- a/frontend/src/components/Sidebar/Sidebar.module.css +++ b/frontend/src/components/Sidebar/Sidebar.module.css | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | transition: all 0.2s ease; | 7 | transition: all 0.2s ease; |
| 8 | padding: 4px 0px; | 8 | padding: 4px 0px; |
| 9 | height: 48px; | 9 | height: 48px; |
| 10 | gap: 24px; | ||
| 10 | } | 11 | } |
| 11 | 12 | ||
| 12 | .button:hover, | 13 | .button:hover, |
| @@ -25,7 +26,7 @@ button>span { | |||
| 25 | font-size: 22px; | 26 | font-size: 22px; |
| 26 | font-family: var(--font-barlow-semicondensed-regular); | 27 | font-family: var(--font-barlow-semicondensed-regular); |
| 27 | white-space: nowrap; | 28 | white-space: nowrap; |
| 28 | margin-left: 16px; | 29 | transition: all 0.2s ease; |
| 29 | } | 30 | } |
| 30 | 31 | ||
| 31 | .button-hidden>span { | 32 | .button-hidden>span { |
diff --git a/frontend/src/components/Sidebar/Sidebar.tsx b/frontend/src/components/Sidebar/Sidebar.tsx index 77e23a6..f280a59 100644 --- a/frontend/src/components/Sidebar/Sidebar.tsx +++ b/frontend/src/components/Sidebar/Sidebar.tsx | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | import React, { useCallback } from "react"; | 1 | import React, { useCallback, useRef } from "react"; |
| 2 | import { useLocation } from "react-router-dom"; | 2 | import { useLocation } from "react-router-dom"; |
| 3 | import { UserProfile } from "@customTypes/Profile"; | 3 | import { UserProfile } from "@customTypes/Profile"; |
| 4 | 4 | ||
| @@ -24,6 +24,8 @@ const Sidebar: React.FC<SidebarProps> = ({ | |||
| 24 | const [isSearching, setIsSearching] = React.useState<boolean>(false); | 24 | const [isSearching, setIsSearching] = React.useState<boolean>(false); |
| 25 | const [selectedButtonIndex, setSelectedButtonIndex] = React.useState<number>(1); | 25 | const [selectedButtonIndex, setSelectedButtonIndex] = React.useState<number>(1); |
| 26 | 26 | ||
| 27 | const searchbarRef = useRef<HTMLInputElement>(null); | ||
| 28 | |||
| 27 | const location = useLocation(); | 29 | const location = useLocation(); |
| 28 | const path = location.pathname; | 30 | const path = location.pathname; |
| 29 | 31 | ||
| @@ -34,6 +36,7 @@ const Sidebar: React.FC<SidebarProps> = ({ | |||
| 34 | if (clicked_sidebar_idx == 0 && !isSearching) { | 36 | if (clicked_sidebar_idx == 0 && !isSearching) { |
| 35 | if (!isSearching) { | 37 | if (!isSearching) { |
| 36 | setIsSearching(true); | 38 | setIsSearching(true); |
| 39 | searchbarRef.current?.focus(); | ||
| 37 | } | 40 | } |
| 38 | } else { | 41 | } else { |
| 39 | setIsSearching(false); | 42 | setIsSearching(false); |
| @@ -57,13 +60,13 @@ const Sidebar: React.FC<SidebarProps> = ({ | |||
| 57 | }, [path]); | 60 | }, [path]); |
| 58 | 61 | ||
| 59 | return ( | 62 | return ( |
| 60 | <div className={`h-screen w-80 not-md:w-full text-white bg-block flex flex-col not-md:flex-row not-md:bg-gradient-to-t not-md:from-block not-md:to-bright | 63 | <div className={`md:h-screen w-80 not-md:w-full text-white bg-block flex flex-col not-md:flex-row not-md:bg-gradient-to-t not-md:from-block not-md:to-bright |
| 61 | }`}> | 64 | }`}> |
| 62 | 65 | ||
| 63 | {/* Header */} | 66 | {/* Header */} |
| 64 | <_Header /> | 67 | <_Header /> |
| 65 | 68 | ||
| 66 | <div className="flex flex-1 overflow-hidden w-full not-md:hidden "> | 69 | <div className="flex flex-1 overflow-hidden w-full"> |
| 67 | <div className={`flex flex-col transition-all duration-300 ${isSearching ? "w-[64px]" : "w-full"}`}> | 70 | <div className={`flex flex-col transition-all duration-300 ${isSearching ? "w-[64px]" : "w-full"}`}> |
| 68 | {/* Sidebar Content */} | 71 | {/* Sidebar Content */} |
| 69 | <_Content isSearching={isSearching} selectedButtonIndex={selectedButtonIndex} handle_sidebar_click={handle_sidebar_click} /> | 72 | <_Content isSearching={isSearching} selectedButtonIndex={selectedButtonIndex} handle_sidebar_click={handle_sidebar_click} /> |
| @@ -73,7 +76,7 @@ const Sidebar: React.FC<SidebarProps> = ({ | |||
| 73 | </div> | 76 | </div> |
| 74 | 77 | ||
| 75 | <div className={`flex bg-panel ${isSearching ? 'w-full' : "w-0"}`}> | 78 | <div className={`flex bg-panel ${isSearching ? 'w-full' : "w-0"}`}> |
| 76 | <_Search profile={profile} /> | 79 | <_Search profile={profile} searchbarRef={searchbarRef} /> |
| 77 | </div> | 80 | </div> |
| 78 | 81 | ||
| 79 | </div> | 82 | </div> |