Files
Shifted/.storybook/mocks/next-navigation.js
2026-02-10 01:14:19 +00:00

39 lines
777 B
JavaScript

const noop = () => {};
function useSearchParams() {
const params = globalThis.__STORYBOOK_SEARCH_PARAMS__ || {};
return {
get: (key) => (key in params ? String(params[key]) : null),
toString: () => new URLSearchParams(params).toString(),
};
}
function usePathname() {
return "/";
}
function useRouter() {
return {
push: noop,
replace: noop,
prefetch: noop,
back: noop,
forward: noop,
refresh: noop,
pathname: "/",
route: "/",
asPath: "/",
query: {},
};
}
function redirect() {
throw new Error("redirect() is not supported in Storybook");
}
function notFound() {
throw new Error("notFound() is not supported in Storybook");
}
module.exports = { useSearchParams, usePathname, useRouter, redirect, notFound };