narpt
TypeScript icon, indicating that this package has built-in type declarations

0.0.20 • Public • Published

narpt - Nextjs App Router Page Transition.

Website

Support

Currently only support NextJS with app router.

Installation

For npm users:

npm i narpt

For yarn users:

yarn add narpt

For pnpm users:

pnpm i narpt

QuickStart

  1. create a new nextjs app with pnpm create next-app, select yes for App Router.
  2. run pnpm i narpt.
  3. replace app/layout.js with the following code.
import { Inter } from 'next/font/google';
import { TransitionLayout } from 'narpt';
const inter = Inter({ subsets: ['latin'] });

export default function RootLayout({ children }) {
  return (
    <html lang='en'>
      <body className={inter.className}>
        <TransitionLayout>{children}</TransitionLayout>
      </body>
    </html>
  );
}
  1. replace app/page.js with the following code.
import { TransitionLink, TransitionDiv } from 'narpt';

export default function Home() {
  return (
    <main>
      <TransitionDiv>
        <TransitionLink href='/about'>Go To About</TransitionLink>
        <div>Home Page</div>
      </TransitionDiv>
    </main>
  );
}
  1. create a new page app/about/page.js and insert the following code.
import { TransitionDiv, TransitionLink } from 'narpt';

const AboutPage = () => {
  return (
    <TransitionDiv>
      <TransitionLink href='/'>Back</TransitionLink>
      <div>About Page</div>
    </TransitionDiv>
  );
};

export default AboutPage;

Full Documentation

Docs

License

The MIT License.

Package Sidebar

Install

npm i narpt

Weekly Downloads

2

Version

0.0.20

License

MIT

Unpacked Size

7.43 kB

Total Files

10

Last publish

Collaborators

  • kwansing14