feat(catalog): add 'image size' and 'show OP comment' options

This commit is contained in:
Tom (plebeius.eth)
2024-06-17 21:16:31 +02:00
parent bf806d6990
commit 7f3630e289
7 changed files with 104 additions and 16 deletions
+23
View File
@@ -0,0 +1,23 @@
import { create } from 'zustand';
interface CatalogStyleStore {
imageSize: 'Small' | 'Large';
setImageSize: (size: 'Small' | 'Large') => void;
showOPComment: boolean;
setShowOPComment: (value: boolean) => void;
}
const useCatalogStyleStore = create<CatalogStyleStore>((set) => ({
imageSize: (localStorage.getItem('imageSize') as 'Small' | 'Large') || 'Small',
setImageSize: (size: 'Small' | 'Large') => {
set({ imageSize: size });
localStorage.setItem('imageSize', size);
},
showOPComment: localStorage.getItem('showOPComment') === 'false' ? false : true,
setShowOPComment: (value: boolean) => {
set({ showOPComment: value });
localStorage.setItem('showOPComment', value.toString());
},
}));
export default useCatalogStyleStore;