From 2276cb0e75356779d175e40550469c8c04a7e69a Mon Sep 17 00:00:00 2001 From: Hailey Date: Thu, 12 Dec 2024 11:50:29 -0800 Subject: 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 --- src/components/Menu/context.tsx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/components/Menu/context.tsx') 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({ export const ItemContext = React.createContext({ 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 +} -- cgit 1.4.1