From fc10dd686b669b468d14024dafe9e3cd8d4ee646 Mon Sep 17 00:00:00 2001 From: Fedor Katurov Date: Fri, 12 Aug 2022 13:37:16 +0700 Subject: [PATCH] added profile cover for profile sidebar --- .../sidebars/ProfileSidebar/index.tsx | 5 ++++- .../sidebars/SidebarWrapper/index.tsx | 17 ++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/containers/sidebars/ProfileSidebar/index.tsx b/src/containers/sidebars/ProfileSidebar/index.tsx index c69151d5..437fdb9b 100644 --- a/src/containers/sidebars/ProfileSidebar/index.tsx +++ b/src/containers/sidebars/ProfileSidebar/index.tsx @@ -2,6 +2,7 @@ import React, { useCallback, useEffect, useMemo, VFC } from "react"; import { isNil } from "ramda"; +import { CoverBackdrop } from "~/components/containers/CoverBackdrop"; import { ProfileSidebarNotes } from "~/components/profile/ProfileSidebarNotes"; import { ProfileSidebarSettings } from "~/components/profile/ProfileSidebarSettings"; import { SidebarStack } from "~/components/sidebar/SidebarStack"; @@ -11,6 +12,7 @@ import { ProfileSidebarMenu } from "~/containers/profile/ProfileSidebarMenu"; import { SidebarWrapper } from "~/containers/sidebars/SidebarWrapper"; import { useAuth } from "~/hooks/auth/useAuth"; import type { SidebarComponentProps } from "~/types/sidebar"; +import { useUser } from "~/hooks/auth/useUser"; const tabs = ["profile", "bookmarks"] as const; type TabName = typeof tabs[number]; @@ -26,6 +28,7 @@ const ProfileSidebar: VFC = ({ openSidebar, }) => { const { isUser } = useAuth(); + const { user: { cover }} = useUser(); const tab = useMemo( () => (page ? Math.max(tabs.indexOf(page), 0) : undefined), @@ -52,7 +55,7 @@ const ProfileSidebar: VFC = ({ } return ( - + }> void; closeOnBackdropClick?: boolean; + backdrop?: ReactNode; } -const SidebarWrapper: FC = ({ children, onClose, closeOnBackdropClick = true }) => { +const SidebarWrapper: FC = ({ + children, + onClose, + closeOnBackdropClick = true, + backdrop, +}) => { const ref = useRef(null); useCloseOnEscape(onClose); @@ -25,7 +31,12 @@ const SidebarWrapper: FC = ({ children, onClose, closeOnBackdropClick = return (
- {closeOnBackdropClick &&
} + {(closeOnBackdropClick || backdrop) && ( +
+ {backdrop} +
+ )} + {children}
);