Skip to content

Commit

Permalink
Feat: added ghost legion hook
Browse files Browse the repository at this point in the history
  • Loading branch information
Akalanka47000 committed Oct 15, 2023
1 parent 1500f75 commit 338289f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/hooks/ghost-legion.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { useState } from "react";
import { useSearchParams } from "react-router-dom";

const useGhostLegion = () => {
const [searchParams, setSearchParams] = useSearchParams();
const [ghostLegion, setGhostLegion] = useState(Boolean(searchParams.get("ghost_legion")));
const toggleGhostLegion = () => {
setGhostLegion(!ghostLegion);
setSearchParams({ ghost_legion: !ghostLegion });
};
return { ghostLegion, toggleGhostLegion };
};

export default useGhostLegion;
1 change: 1 addition & 0 deletions src/hooks/index.jsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export { default as useBreakpoint } from "./breakpoint";
export { default as useGhostLegion } from "./ghost-legion";
export { default as useRound } from "./round";

0 comments on commit 338289f

Please sign in to comment.