You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
406 B
14 lines
406 B
import { useContext } from "react" |
|
import { ServerSidePropsContext } from "../contextProviders/serverSidePropsProvider" |
|
import jsCookies from "js-cookie" |
|
|
|
const COOKIE_NAME = "theme" |
|
|
|
export const useCurrentTheme = () => { |
|
const { cookies } = useContext(ServerSidePropsContext) |
|
if (cookies) { |
|
return jsCookies.get(COOKIE_NAME) || cookies[COOKIE_NAME] || "light" |
|
} else { |
|
return "light" |
|
} |
|
}
|
|
|