v2: global player, infinite scroll, image picker, threaded comments
This commit is contained in:
14
src/contexts/PlayerProvider.tsx
Normal file
14
src/contexts/PlayerProvider.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import { useState } from "react";
|
||||
import { PlayerContext, type PlayerItem } from "./PlayerContext.ts";
|
||||
|
||||
export function PlayerProvider({ children }: { children: React.ReactNode }) {
|
||||
const [current, setCurrent] = useState<PlayerItem | null>(null);
|
||||
|
||||
return (
|
||||
<PlayerContext.Provider
|
||||
value={{ current, play: setCurrent, stop: () => setCurrent(null) }}
|
||||
>
|
||||
{children}
|
||||
</PlayerContext.Provider>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user