Skip to content

Commit

Permalink
refactor: BucketContentsLayout and AppRoutes
Browse files Browse the repository at this point in the history
  • Loading branch information
jer-nc committed Dec 21, 2023
1 parent 94236de commit f293b94
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
13 changes: 5 additions & 8 deletions src/components/custom/layouts/BucketContentsLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import { Button } from '@/components/ui/button';
import { ChevronLeft, RefreshCcw } from 'lucide-react';
import React from 'react'
import { useLocation, useNavigate } from 'react-router-dom';
import { useLocation, useNavigate, useOutlet } from 'react-router-dom';


type Props = {
children: React.ReactNode;
}

const BucketContentsLayout = ({ children }: Props) => {
const BucketContentsLayout = () => {
const outlet = useOutlet();
const { pathname: currentPathname } = useLocation()
const navigate = useNavigate();

console.log('currentPathname', currentPathname)

const handleNavigate = () => {
Expand Down Expand Up @@ -42,7 +39,7 @@ const BucketContentsLayout = ({ children }: Props) => {
<RefreshCcw size={18} />
</Button>
</div>
{children}
{outlet}
</div>
)
}
Expand Down
7 changes: 4 additions & 3 deletions src/routes/AppRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ function AppRoutes() {
return (
<Routes>
<Route path="/" element={<HomePage />} />
{/* <Route path="buckets/*" element={<FolderPage />} /> */}
<Route path="/buckets/:bucketId" element={<BucketContentsLayout> <FolderPage /> </BucketContentsLayout>} />
<Route path="/buckets/:bucketId/*" element={<BucketContentsLayout> <SubFolderPage /> </BucketContentsLayout>} />
<Route path="/buckets/:bucketId" element={<BucketContentsLayout />}>
<Route index element={<FolderPage />} />
<Route path="*" element={<SubFolderPage />} />
</Route>
</Routes>
);
}
Expand Down

0 comments on commit f293b94

Please sign in to comment.