Grabbed dndbeyond's source code
``` ~/go/bin/sourcemapper -output ddb -jsurl https://media.dndbeyond.com/character-app/static/js/main.90aa78c5.js ```
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { createContext, FC, useContext, useState } from "react";
|
||||
|
||||
import { MobileSections } from "../../types";
|
||||
|
||||
export interface SheetContextType {
|
||||
mobileActiveSectionId: MobileSections;
|
||||
setMobileActiveSectionId: (sectionId: MobileSections) => void;
|
||||
setSwipedAmount: (amount: number) => void;
|
||||
swipedAmount: number;
|
||||
}
|
||||
|
||||
export const SheetContext = createContext<SheetContextType>(null!);
|
||||
|
||||
export const SheetProvider: FC = ({ children }) => {
|
||||
const [mobileActiveSectionId, setMobileActiveSectionId] =
|
||||
useState<MobileSections>("main");
|
||||
const [swipedAmount, setSwipedAmount] = useState(0);
|
||||
|
||||
return (
|
||||
<SheetContext.Provider
|
||||
value={{
|
||||
mobileActiveSectionId,
|
||||
setMobileActiveSectionId,
|
||||
setSwipedAmount,
|
||||
swipedAmount,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</SheetContext.Provider>
|
||||
);
|
||||
};
|
||||
|
||||
export const useSheetContext = () => {
|
||||
return useContext(SheetContext);
|
||||
};
|
||||
Reference in New Issue
Block a user