mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-10 04:30:25 +02:00
Add generic list context
This commit is contained in:
@@ -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 New Issue
Block a user