mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
feat(catalog): add 'image size' and 'show OP comment' options
This commit is contained in:
@@ -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;
|
||||
Reference in New Issue
Block a user