Skyleen77 / next-nprogress-bar

NProgress integration on Next.js compatible with /app and /pages folders
https://next-nprogress-bar.vercel.app
348 stars 27 forks source link

More control of displayed components #71

Open FezVrasta opened 4 months ago

FezVrasta commented 4 months ago

Thanks for the library. Do you think you could add an option to only show the spinner and not the top bar?

Also, it would extremely handy if it could be possible to control the visibility of both components from a programmatic interface. I think an API similar to the React startTransition would be great.

import { startProgress, startBarProgress, startSpinnerProgress } from "next-nprogress-bar";

const App () => {
  const { data, load, refresh } = useMyData();

  const load = () => {
    startBarProgress(() => {
      load();
    });
  });

  const refresh = () => {
    startSpinnerProgress(() => {
      refresh();
    });
  });

  return data;
}
Skyleen77 commented 2 weeks ago

I use NProgress, to my knowledge there are no options to do this with NProgress. I don't want to add too much complexity to do this kind of option. However, if you have an idea of a simple way to do this, please don't hesitate to submit a PR.