Skip to content

Commit

Permalink
Fullscreen toggling in same function
Browse files Browse the repository at this point in the history
  • Loading branch information
Huzaif-Ahmed committed Oct 8, 2023
1 parent d07727a commit 811526a
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/components/Tutorials/subComps/TutorialTitle.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import FullscreenIcon from "@mui/icons-material/Fullscreen";
import FullscreenExitIcon from '@mui/icons-material/FullscreenExit'
import { useState } from "react";
import { Typography } from "@mui/material";
import { set } from "lodash";

const TutorialHeading = ({
stepPanelVisible,
Expand All @@ -18,13 +19,15 @@ const TutorialHeading = ({
let [Fullscreen, setFullscreen] = useState(false);

const toggleFullscreen = () => {
setFullscreen(true);
document.documentElement.requestFullscreen();
if (Fullscreen) {
setFullscreen(false);
document.exitFullscreen();
} else {
setFullscreen(true);
document.documentElement.requestFullscreen();
}
setFullscreen(!document.fullscreenElement);
};
const togglesmallScreen = () => {
setFullscreen(false);
document.exitFullscreen();
}

let styleProps = {
backgroundColor: tutorialData.background_color || "#ffffff",
Expand Down Expand Up @@ -62,7 +65,7 @@ const TutorialHeading = ({
{Fullscreen ? <Tooltip placement="left" title={"exit Fullscreen"}>
<Button
type="dashed"
onClick={togglesmallScreen}
onClick={toggleFullscreen}
className="bp-8"
style={{ ...styleProps }}
>
Expand Down

0 comments on commit 811526a

Please sign in to comment.