Add generic list context
This commit is contained in:
parent
4029127018
commit
9bcefb3105
1 changed files with 19 additions and 0 deletions
19
src/renderer/context/list-context.tsx
Normal file
19
src/renderer/context/list-context.tsx
Normal file
|
@ -0,0 +1,19 @@
|
|||
import { createContext, useContext } from 'react';
|
||||
import { ListKey } from '/@/renderer/store';
|
||||
import { Play } from '/@/renderer/types';
|
||||
|
||||
interface ListContextProps {
|
||||
customFilters?: Record<string, unknown>;
|
||||
handlePlay?: (args: { initialSongId?: string; playType: Play }) => void;
|
||||
id?: string;
|
||||
pageKey: ListKey;
|
||||
}
|
||||
|
||||
export const ListContext = createContext<ListContextProps>({
|
||||
pageKey: '',
|
||||
});
|
||||
|
||||
export const useListContext = () => {
|
||||
const ctxValue = useContext(ListContext);
|
||||
return ctxValue;
|
||||
};
|
Reference in a new issue