Skip to content

Commit

Permalink
Merge pull request #18 from Moaguide-develop/fix/nav
Browse files Browse the repository at this point in the history
fix: suspense 제거
  • Loading branch information
eun-hak authored Sep 5, 2024
2 parents 1f587ad + 59cb013 commit e86143d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 28 deletions.
12 changes: 5 additions & 7 deletions src/app/newissue/page.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
'use clinet';
import RecentlyIssueIndex from '@/components/recentlyIssue/Index';
import Navbar from '@/components/common/Navbar';
import { Suspense } from 'react';
const NewIssuePage = () => {
return (
<Suspense fallback={<div>Loading...</div>}>
<div>
<Navbar />
<RecentlyIssueIndex />
</div>
</Suspense>
<div>
<Navbar />
<RecentlyIssueIndex />
</div>
);
};

Expand Down
13 changes: 6 additions & 7 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
'use clinet';
import Navbar from '@/components/common/Navbar';
import HomeIndex from '@/components/home/Index';
import React, { Suspense } from 'react';
import React from 'react';

const HomePage = () => {
return (
<Suspense fallback={<div>Loading...</div>}>
<div>
<Navbar />
<HomeIndex />
</div>
</Suspense>
<div>
<Navbar />
<HomeIndex />
</div>
);
};

Expand Down
12 changes: 5 additions & 7 deletions src/app/reportpage/page.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
'use clinet';
import ReportIndex from '@/components/report/ReportIndex';
import Navbar from '@/components/common/Navbar';
import { Suspense } from 'react';
const ReportPage = () => {
return (
<Suspense fallback={<div>Loading...</div>}>
<div>
<Navbar />
<ReportIndex />
</div>
</Suspense>
<div>
<Navbar />
<ReportIndex />
</div>
);
};

Expand Down
9 changes: 2 additions & 7 deletions src/components/common/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
'use client';

import React from 'react';
import { useRouter, useSearchParams, usePathname } from 'next/navigation';
import { Suspense } from 'react';
import { useRouter, usePathname } from 'next/navigation';

const Navbar = () => {
const params = useSearchParams();
const router = useRouter();
const pathname = usePathname();
const category = params.get('category');
console.log(pathname);
const isHomeActive = pathname === '/' && (category === null || category === '');

return (
<div className="shadow-custom-light border-b border-gray100">
Expand All @@ -20,7 +15,7 @@ const Navbar = () => {
router.push('/');
}}
className={`px-4 py-3 flex-1 flex justify-center items-center cursor-pointer text-body5 desk2:text-heading4
${isHomeActive ? 'text-black border-b-[2px] border-black' : 'text-gray300'}
${pathname === '/' ? 'text-black border-b-[2px] border-black' : 'text-gray300'}
`}>
</div>
Expand Down

0 comments on commit e86143d

Please sign in to comment.