feat: page turner

This commit is contained in:
TrèsAbhi committed 2023-12-03 19:45:43 -06:00
1 parent 579d7570af
commit c5e1a7d6ab
8 files changed
+322 -144

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
import { produce } from 'immer';
import { create } from 'zustand';
import { devtools, persist } from 'zustand/middleware';
export type TankopediaSortBy = 'tier';
export type TankopediaSortDirection = 'ascending' | 'descending';
type Tankopedia = {
sortBy: TankopediaSortBy;
sortDirection: TankopediaSortDirection;
};
export const useTankopedia = create<Tankopedia>()(
devtools(
persist(
(set) => ({
sortBy: 'tier',
sortDirection: 'descending',
}),
{ name: 'tankopedia' },
),
),
);
export default function mutateTankopedia(recipe: (draft: Tankopedia) => void) {
useTankopedia.setState(produce(recipe));
}