@dmartss/with-nprogress

2.0.6 • Public • Published

@dmartss/with-nprogress

Next.js HOC to integrate NProgress inside your app.

This is configured to run only after a delay of (default) 300ms. This means if the page change takes too long it will render the progress bar, but if it's fast enough it will avoid rendering it.

Usage

Install it

yarn add next-nprogress

Import it inside your pages/_app.js;

import withNProgress from '@dmartss/with-nprogress'
import NProgressStyles from '@dmartss/with-nprogress/styles'

Wrap your custom App container with it

const msDelay = 300 // default is 300
export default withNProgress(msDelay)(MyApp)

And render NProgressStyles inside your App container or layout component

// the default progress bar and spinner color is #29d, it could be changed for any CSS color
<NProgressStyles color="#29d" />

That's it. Now NProgress will work automatically and will render the correct styles using styled-jsx.

Package Sidebar

Install

npm i @dmartss/with-nprogress

Weekly Downloads

1

Version

2.0.6

License

MIT

Unpacked Size

12.1 kB

Total Files

8

Last publish

Collaborators

  • dmartss