@mhmdaljefri/next-nprogress
TypeScript icon, indicating that this package has built-in type declarations

0.2.9 • Public • Published

nextjs-nprogress

An unofficial nextjs wrapper of nprogress package.

Installing

npm i @mhmdaljefri/next-nprogress nprogress # yarn add @mhmdaljefri/next-nprogress nprogress

Example

Adding nprogress default configurations and styles

import NextNPregress from "@mhmdaljefri/next-nprogress";
// ... code
<NextNPregress />
// ... code

Adding nprogress with customer configurations and styles

import NextNPregress from "@mhmdaljefri/next-nprogress";
// ... code
<NextNPregress
  configurationOptions={{
    stopDelay: 400,
    color: "red",
    showSpinner: false,
  }}
/>
// ... code

Using context to change configurations and styles

import NextNPregress, { useUpdateProgressConfig } from "@mhmdaljefri/next-nprogress";
// ... code
return (
  <NextNPregress
    configurationOptions={{
      stopDelay: 400,
      color: "red",
      showSpinner: false,
    }}
  >
    <Component>
  <NextNPregress>
)
// ... code



const Component = () => {
  const updateProgressConfig = useUpdateProgressConfig()

  React.useEffect(() => {
    updateProgressConfig({ color: 'blue' });
  })

  return (
    <div>
      {/* code here */}
    </div>
  )
}

Readme

Keywords

Package Sidebar

Install

npm i @mhmdaljefri/next-nprogress

Weekly Downloads

1

Version

0.2.9

License

MIT

Unpacked Size

47.6 kB

Total Files

14

Last publish

Collaborators

  • m_aljefri