@slashid/docusaurus-theme-slashid
Version:
SlashID theme for Docusaurus.
25 lines (23 loc) • 814 B
JavaScript
/* ============================================================================
* Copyright (c) SlashID
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
* ========================================================================== */
import React, { createContext, useMemo, useState } from "react";
export const AuthContext = createContext({
showLogin: false,
setShowLogin: (b) => undefined,
});
export const AuthProvider = ({ children }) => {
const [showLogin, setShowLogin] = useState(false);
const value = useMemo(
() => ({
showLogin,
setShowLogin,
}),
[showLogin]
);
return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>;
};
AuthContext.displayName = "SlashIDContext";