Skip to content

Commit 34744b8

Browse files
committed
ui/useUIStore
1 parent 737df50 commit 34744b8

File tree

4 files changed

+22
-5
lines changed

4 files changed

+22
-5
lines changed

packages/ui/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"tailwindcss": "^3.1.5",
4141
"tsconfig": "workspace:*",
4242
"tsup": "^8.2.4",
43-
"typescript": "^5.5.4"
43+
"typescript": "^5.5.4",
44+
"zustand": "5.0.1"
4445
}
4546
}

packages/ui/src/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ export * from './TextAnimation'
33
export * from './TextHover'
44

55
export * from './ShaderGradientUI'
6+
7+
export * from './store'

packages/ui/src/store.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { create } from 'zustand'
2+
import { combine } from 'zustand/middleware'
3+
4+
export const useUIStore = create(
5+
combine({ activePreset: 0, mode: 'full', loadingPercentage: 0 }, (set) => ({
6+
setActivePreset: (by: number) => set((state) => ({ activePreset: by })),
7+
setMode: (data: any) => set((state) => ({ ...state, mode: data })),
8+
setLoadingPercentage: (data: any) =>
9+
set((state) => ({ ...state, loadingPercentage: data })),
10+
}))
11+
)

pnpm-lock.yaml

+7-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)