Skip to content

Commit

Permalink
fix(demo-app): router
Browse files Browse the repository at this point in the history
  • Loading branch information
Skyleen77 committed Mar 1, 2024
1 parent 5b2b786 commit b75ab9e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 38 deletions.
22 changes: 3 additions & 19 deletions demo/demo-app/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

import { Home } from '@/components/home';
import { ProgressLinkProps } from '@/components/progress-link';
import { useProgress } from '@/context/progress-context';
import { useRouter } from 'next-nprogress-bar';

export default function HomePage() {
const router = useRouter();
const { showSpinner } = useProgress();

const progressLinks: ProgressLinkProps[] = [
{
Expand Down Expand Up @@ -82,13 +80,7 @@ export default function HomePage() {

{
onClick: () => {
router.push(
'/page',
{},
{
showProgressBar: showSpinner,
},
);
router.push('/page');
},
children: (
<>
Expand All @@ -98,13 +90,7 @@ export default function HomePage() {
},
{
onClick: () => {
router.replace(
'/?test=param',
{},
{
showProgressBar: showSpinner,
},
);
router.replace('/?test=param');
},
children: (
<>
Expand All @@ -114,9 +100,7 @@ export default function HomePage() {
},
{
onClick: () => {
router.back({
showProgressBar: showSpinner,
});
router.back();
},
children: <>router.back()</>,
},
Expand Down
22 changes: 3 additions & 19 deletions demo/demo-app/app/page/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

import { Home } from '@/components/home';
import { ProgressLinkProps } from '@/components/progress-link';
import { useProgress } from '@/context/progress-context';
import { useRouter } from 'next-nprogress-bar';

export default function Page() {
const router = useRouter();
const { showSpinner } = useProgress();

const progressLinks: ProgressLinkProps[] = [
{
Expand Down Expand Up @@ -82,13 +80,7 @@ export default function Page() {

{
onClick: () => {
router.push(
'/',
{},
{
showProgressBar: showSpinner,
},
);
router.push('/');
},
children: (
<>
Expand All @@ -98,13 +90,7 @@ export default function Page() {
},
{
onClick: () => {
router.replace(
'/?test=param',
{},
{
showProgressBar: showSpinner,
},
);
router.replace('/?test=param');
},
children: (
<>
Expand All @@ -114,9 +100,7 @@ export default function Page() {
},
{
onClick: () => {
router.back({
showProgressBar: showSpinner,
});
router.back();
},
children: <>router.back()</>,
},
Expand Down

0 comments on commit b75ab9e

Please sign in to comment.