refactor: use blurhash to render background
This commit is contained in:
12 files changed
+205
-164
No files matched your search
@@ -1,24 +1,13 @@
|
||||
import { shallow } from "zustand/shallow";
|
||||
import { createWithEqualityFn } from "zustand/traditional";
|
||||
import { create } from "zustand";
|
||||
|
||||
type BackdropStore = {
|
||||
backdropUrl: string;
|
||||
backdropId: string;
|
||||
setBackdrop: (url: string | undefined, id: string | undefined) => void;
|
||||
backdropHash: string;
|
||||
// backdropId: string;
|
||||
setBackdrop: (hash: string | undefined) => void;
|
||||
};
|
||||
|
||||
export const useBackdropStore = createWithEqualityFn<BackdropStore>(
|
||||
(set) => ({
|
||||
backdropUrl: "",
|
||||
backdropId: "",
|
||||
setBackdrop: (url, id) => set(() => ({ backdropUrl: url, backdropId: id })),
|
||||
}),
|
||||
shallow,
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated Please use setBackdrop method from the store
|
||||
*/
|
||||
export const setBackdrop = () => {
|
||||
// useBackdropStore.setState(() => ({ backdropUrl: url, backdropId: id }));
|
||||
};
|
||||
export const useBackdropStore = create<BackdropStore>((set) => ({
|
||||
backdropHash: "",
|
||||
// backdropI: "",
|
||||
setBackdrop: (hash) => set(() => ({ backdropHash: hash })),
|
||||
}));
|
||||
Reference in new issue
Block a user