feat: change from dummy button to navbar button
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
export * from './use-query-state';
|
||||
export * from './use-session';
|
||||
export * from './use-modal-login';
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import { createContext, ReactNode, useContext, useState } from 'react';
|
||||
|
||||
interface ModalLoginContextType {
|
||||
showModalLogin: boolean;
|
||||
setShowModalLogin: (value: boolean) => void;
|
||||
}
|
||||
|
||||
const ModalLoginContext = createContext<ModalLoginContextType | undefined>(
|
||||
undefined
|
||||
);
|
||||
|
||||
export const ModalLoginProvider = ({ children }: { children: ReactNode }) => {
|
||||
const [showModalLogin, setShowModalLogin] = useState(false);
|
||||
|
||||
return (
|
||||
<ModalLoginContext.Provider value={{ showModalLogin, setShowModalLogin }}>
|
||||
{children}
|
||||
</ModalLoginContext.Provider>
|
||||
);
|
||||
};
|
||||
|
||||
export const useModalLogin = () => {
|
||||
const context = useContext(ModalLoginContext);
|
||||
if (!context) {
|
||||
throw new Error('useModalLogin must be used within an ModalLoginProvider');
|
||||
}
|
||||
return context;
|
||||
};
|
||||
Reference in New Issue
Block a user