mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2026-12-05 16:33:36 +00:00
ThemeProvider nitpicks
This commit is contained in:
4 files changed
+26
-24
No files matched your search
@@ -1,11 +1,13 @@
|
||||
import { useContext } from "react"
|
||||
import { ThemeProviderContext } from "@/lib/theme-context"
|
||||
import { ThemeContext, type ThemeContextType } from "@/lib/ThemeContext"
|
||||
|
||||
export const useTheme = () => {
|
||||
const context = useContext(ThemeProviderContext)
|
||||
/** Hook to get and set the active theme. */
|
||||
export function useTheme(): ThemeContextType {
|
||||
const context = useContext(ThemeContext);
|
||||
|
||||
if (context === undefined)
|
||||
throw new Error("useTheme must be used within a ThemeProvider")
|
||||
if (!context) {
|
||||
throw new Error("useTheme must be used within a ThemeProvider");
|
||||
}
|
||||
|
||||
return context
|
||||
return context;
|
||||
}
|
||||
Reference in new issue
Block a user