diff options
author | Hailey <me@haileyok.com> | 2024-12-12 11:50:29 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-12 13:50:29 -0600 |
commit | 2276cb0e75356779d175e40550469c8c04a7e69a (patch) | |
tree | 74837e1d6c65ccc997dda221a29d9d68f77979ba /src/components/Menu/context.tsx | |
parent | 2808f8b73da4791e0f3cb85b03403738e5bf6b63 (diff) | |
download | voidsky-2276cb0e75356779d175e40550469c8c04a7e69a.tar.zst |
Fix share button not working for some users (#5849)
* fix share button * Revert "fix share button" This reverts commit 3521c241729dc9bbe3dd7b62fc6e3e61e011cdf9. * tweak * Clean up context --------- Co-authored-by: Eric Bailey <git@esb.lol>
Diffstat (limited to 'src/components/Menu/context.tsx')
-rw-r--r-- | src/components/Menu/context.tsx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/components/Menu/context.tsx b/src/components/Menu/context.tsx index 1ddcd583f..908ad352e 100644 --- a/src/components/Menu/context.tsx +++ b/src/components/Menu/context.tsx @@ -10,3 +10,23 @@ export const Context = React.createContext<ContextType>({ export const ItemContext = React.createContext<ItemContextType>({ disabled: false, }) + +export function useMenuContext() { + const context = React.useContext(Context) + + if (!context) { + throw new Error('useMenuContext must be used within a Context.Provider') + } + + return context +} + +export function useMenuItemContext() { + const context = React.useContext(ItemContext) + + if (!context) { + throw new Error('useMenuItemContext must be used within a Context.Provider') + } + + return context +} |