7 changed files with 84 additions and 40 deletions
@ -1,27 +1,24 @@ |
|||||||
// import { useCallback, useContext } from "react";
|
import { useCallback } from "react"; |
||||||
// import {
|
import { useVideoPlayerState } from "../VideoContext"; |
||||||
// VideoPlayerContext,
|
|
||||||
// VideoPlayerDispatchContext,
|
|
||||||
// } from "../VideoContext";
|
|
||||||
|
|
||||||
export function FullscreenControl() { |
export function FullscreenControl() { |
||||||
return <p>Hello world</p>; |
const { videoState } = useVideoPlayerState(); |
||||||
// const dispatch = useContext(VideoPlayerDispatchContext);
|
|
||||||
// const video = useContext(VideoPlayerContext);
|
|
||||||
|
|
||||||
// const handleClick = useCallback(() => {
|
const handleClick = useCallback(() => { |
||||||
// dispatch({
|
if (videoState.isFullscreen) videoState.exitFullscreen(); |
||||||
// type: "FULLSCREEN",
|
else videoState.enterFullscreen(); |
||||||
// do: video.fullscreen ? "EXIT" : "ENTER",
|
}, [videoState]); |
||||||
// });
|
|
||||||
// }, [video, dispatch]);
|
|
||||||
|
|
||||||
// let text = "not fullscreen";
|
let text = "not fullscreen"; |
||||||
// if (video.fullscreen) text = "in fullscreen";
|
if (videoState.isFullscreen) text = "in fullscreen"; |
||||||
|
|
||||||
// return (
|
return ( |
||||||
// <button type="button" onClick={handleClick}>
|
<button |
||||||
// {text}
|
className="m-1 rounded bg-denim-100 p-1 text-white hover:opacity-75" |
||||||
// </button>
|
type="button" |
||||||
// );
|
onClick={handleClick} |
||||||
|
> |
||||||
|
{text} |
||||||
|
</button> |
||||||
|
); |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue