diff --git a/src/Components/Common/Sidebar/Sidebar.tsx b/src/Components/Common/Sidebar/Sidebar.tsx index f7044d84b02..5271eb1cdaf 100644 --- a/src/Components/Common/Sidebar/Sidebar.tsx +++ b/src/Components/Common/Sidebar/Sidebar.tsx @@ -123,6 +123,7 @@ const StatelessSidebar = ({ setShrinked && setShrinked(!shrinked)} + handleOverflow={handleOverflow} /> )} @@ -142,6 +143,7 @@ const StatelessSidebar = ({ setShrinked && setShrinked(!shrinked)} + handleOverflow={handleOverflow} /> )} @@ -188,7 +190,7 @@ const StatelessSidebar = ({
- +
); @@ -230,20 +232,45 @@ export const MobileSidebar = (props: MobileSidebarProps) => { interface ToggleShrinkProps { shrinked: boolean; toggle: () => void; + handleOverflow: (value: boolean) => void; } -const ToggleShrink = ({ shrinked, toggle }: ToggleShrinkProps) => ( -
- -
-); +interface ToggleShrinkProps { + shrinked: boolean; + toggle: () => void; + handleOverflow: (value: boolean) => void; +} + +const ToggleShrink: React.FC = ({ + shrinked, + toggle, + handleOverflow, +}) => { + const Item = shrinked ? ShrinkedSidebarItem : SidebarItem; + + return ( +
+ + } + do={() => { + toggle(); + + handleOverflow(!shrinked); + }} + handleOverflow={handleOverflow} + /> +
+ ); +}; diff --git a/src/Components/Common/Sidebar/SidebarUserCard.tsx b/src/Components/Common/Sidebar/SidebarUserCard.tsx index 9e9b113c4aa..67fd91c85ff 100644 --- a/src/Components/Common/Sidebar/SidebarUserCard.tsx +++ b/src/Components/Common/Sidebar/SidebarUserCard.tsx @@ -1,62 +1,54 @@ import React from "react"; -import { Link } from "raviger"; + import { useTranslation } from "react-i18next"; import CareIcon from "../../../CAREUI/icons/CareIcon"; import { formatName, formatDisplayName } from "../../../Utils/utils"; import useAuthUser, { useAuthContext } from "../../../Common/hooks/useAuthUser"; import { Avatar } from "@/Components/Common/Avatar"; +import { ShrinkedSidebarItem, SidebarItem } from "./SidebarItem"; interface SidebarUserCardProps { shrinked: boolean; + handleOverflow: (value: boolean) => void; } -const SidebarUserCard: React.FC = ({ shrinked }) => { +const SidebarUserCard: React.FC = ({ + shrinked, + handleOverflow, +}) => { const { t } = useTranslation(); const user = useAuthUser(); const { signOut } = useAuthContext(); + const Item = shrinked ? ShrinkedSidebarItem : SidebarItem; return (
- -
-
- -
- {!shrinked && ( - - {formatName(user)} - - )} -
-
-
-
- -
- - {!shrinked && ( -
- {t("sign_out")} -
- )} -
+ } + selected={false} + handleOverflow={handleOverflow} + />
+ + } + selected={false} + do={signOut} + handleOverflow={handleOverflow} + />
); };