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>
This commit is contained in:
Hailey
2024-12-12 11:50:29 -08:00
committed by GitHub
parent 2808f8b73d
commit 2276cb0e75
3 changed files with 48 additions and 27 deletions
+20
View File
@@ -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
}