mirror of
https://github.com/DefectingCat/DefectingCat.github.io
synced 2025-07-15 16:51:37 +00:00
feat(3d): add camera animation
when hover on navbar
This commit is contained in:
@ -1,8 +1,21 @@
|
||||
import { create } from 'zustand';
|
||||
|
||||
// type NavbarHoverItemsKey = ['blog', 'projects', 'tags', 'friends', 'about'];
|
||||
|
||||
interface MainStore {
|
||||
/** Loading state of the model */
|
||||
modelLoading: boolean;
|
||||
toggleLoading: (loaded: boolean) => void;
|
||||
|
||||
/** mouse hover on navbar */
|
||||
navbarHoverItems: {
|
||||
blog: boolean;
|
||||
projects: boolean;
|
||||
tags: boolean;
|
||||
friends: boolean;
|
||||
about: boolean;
|
||||
};
|
||||
toggleNavbarHoverItems: (item: string) => void;
|
||||
}
|
||||
|
||||
const useStore = create<MainStore>()((set) => ({
|
||||
@ -11,6 +24,23 @@ const useStore = create<MainStore>()((set) => ({
|
||||
set(() => ({
|
||||
modelLoading: loaded,
|
||||
})),
|
||||
|
||||
navbarHoverItems: {
|
||||
blog: false,
|
||||
projects: false,
|
||||
tags: false,
|
||||
friends: false,
|
||||
about: false,
|
||||
} as const,
|
||||
toggleNavbarHoverItems: (item) =>
|
||||
set((state) => ({
|
||||
navbarHoverItems: {
|
||||
...state.navbarHoverItems,
|
||||
[item as unknown as string]:
|
||||
/** @ts-expect-error */
|
||||
!state.navbarHoverItems[item],
|
||||
},
|
||||
})),
|
||||
}));
|
||||
|
||||
export default useStore;
|
||||
|
Reference in New Issue
Block a user