From ce7ddf7be365bca5b61a60a56cc7c3928b92a512 Mon Sep 17 00:00:00 2001 From: Johnson Mao <86179381+JohnsonMao@users.noreply.github.com> Date: Sat, 27 Jul 2024 20:26:17 +0800 Subject: [PATCH] feature: update layout v2 (#401) * chore: update web style and tailwind config * feature: add search bar and chat component to layout --- components/shared/Chat/v2/Chat.tsx | 4 ++- components/shared/Chat/v2/ChatHeader.tsx | 2 +- components/shared/Header.tsx | 8 ++++-- components/shared/SearchBar/SearchBar.tsx | 2 +- components/shared/Sidebar.tsx | 2 +- containers/layout/AppLayout.tsx | 34 +++++++++++++++++------ pages/_document.tsx | 2 +- pages/index.tsx | 15 ++++++++-- tailwind.config.js | 1 + 9 files changed, 51 insertions(+), 19 deletions(-) diff --git a/components/shared/Chat/v2/Chat.tsx b/components/shared/Chat/v2/Chat.tsx index bd4c8f3f..5f05911f 100644 --- a/components/shared/Chat/v2/Chat.tsx +++ b/components/shared/Chat/v2/Chat.tsx @@ -12,6 +12,7 @@ export type ChatProps = { lobbyMessages: MessageType[]; friendList: FriendType[]; roomMessages: MessageType[]; + maxHeight?: string; }; export default function Chat({ @@ -19,6 +20,7 @@ export default function Chat({ lobbyMessages, friendList, roomMessages, + maxHeight = "calc(100vh - 10rem)", }: Readonly) { const [messages, setMessages] = useState(lobbyMessages); const [target, setTarget] = useState<[ChatTab["id"], string | null]>([ @@ -70,7 +72,7 @@ export default function Chat({ return (
- {notifications && ( + {Number(notifications) > 0 && ( {notifications} diff --git a/components/shared/Header.tsx b/components/shared/Header.tsx index ef341948..d0cd3111 100644 --- a/components/shared/Header.tsx +++ b/components/shared/Header.tsx @@ -20,7 +20,11 @@ interface ButtonProps { onClick: () => void; } -export default function Header() { +interface HeaderProps { + onClickChatButton: () => void; +} + +export default function Header({ onClickChatButton }: Readonly) { const [openProfile, setOpenProfile] = useState(false); const buttons: ButtonProps[] = [ @@ -28,7 +32,7 @@ export default function Header() { iconName: "chatDefault", type: HeaderActions.CHAT, isActive: false, - onClick: () => {}, + onClick: onClickChatButton, }, { iconName: "notificationDefault", diff --git a/components/shared/SearchBar/SearchBar.tsx b/components/shared/SearchBar/SearchBar.tsx index 57747926..3ad93817 100644 --- a/components/shared/SearchBar/SearchBar.tsx +++ b/components/shared/SearchBar/SearchBar.tsx @@ -38,7 +38,7 @@ export const SearchBar = ({ {leftSlot} setValue(e.target.value)} diff --git a/components/shared/Sidebar.tsx b/components/shared/Sidebar.tsx index 477852e5..2a54d719 100644 --- a/components/shared/Sidebar.tsx +++ b/components/shared/Sidebar.tsx @@ -30,7 +30,7 @@ export default function Sidebar() { ]; return ( -