From 9d4e30d9ea8f483a2750911e1f0713b185bdd97a Mon Sep 17 00:00:00 2001 From: Abhinav Date: Thu, 9 Jun 2022 12:45:29 +0530 Subject: [PATCH] remove sidebar props from context --- src/components/Sidebar/index.tsx | 13 ++++++++----- src/pages/gallery/index.tsx | 12 ++++++------ src/types/gallery/index.ts | 2 -- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/components/Sidebar/index.tsx b/src/components/Sidebar/index.tsx index f585e9e4b..c9f401216 100644 --- a/src/components/Sidebar/index.tsx +++ b/src/components/Sidebar/index.tsx @@ -1,4 +1,4 @@ -import React, { useContext } from 'react'; +import React from 'react'; import NavigationSection from './NavigationSection'; import UtilitySection from './UtilitySection'; @@ -9,14 +9,17 @@ import { DrawerSidebar, PaddedDivider } from './styledComponents'; import HeaderSection from './Header'; import { CollectionSummaries } from 'types/collection'; import UserDetailsSection from './userDetailsSection'; -import { GalleryContext } from 'pages/gallery'; interface Iprops { collectionSummaries: CollectionSummaries; + sidebarView: boolean; + closeSidebar: () => void; } -export default function Sidebar({ collectionSummaries }: Iprops) { - const { sidebarView, closeSidebar } = useContext(GalleryContext); - +export default function Sidebar({ + collectionSummaries, + sidebarView, + closeSidebar, +}: Iprops) { return ( diff --git a/src/pages/gallery/index.tsx b/src/pages/gallery/index.tsx index 280491a5e..2ae56524f 100644 --- a/src/pages/gallery/index.tsx +++ b/src/pages/gallery/index.tsx @@ -130,8 +130,6 @@ const defaultGalleryContext: GalleryContextType = { syncWithRemote: () => null, setNotificationAttributes: () => null, setBlockingLoad: () => null, - sidebarView: false, - closeSidebar: () => null, }; export const GalleryContext = createContext( @@ -204,7 +202,7 @@ export default function Gallery() { const [electronFiles, setElectronFiles] = useState(null); const [uploadTypeSelectorView, setUploadTypeSelectorView] = useState(false); - const [sidebarView, setSidebarView] = useState(false); + const [sidebarView, setSidebarView] = useState(true); const closeSidebar = () => setSidebarView(false); const openSidebar = () => setSidebarView(true); @@ -584,8 +582,6 @@ export default function Gallery() { syncWithRemote, setNotificationAttributes, setBlockingLoad, - closeSidebar, - sidebarView, }}> - + Promise; setNotificationAttributes: (attributes: NotificationAttributes) => void; setBlockingLoad: (value: boolean) => void; - sidebarView: boolean; - closeSidebar: () => void; };