Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full screen toggling feature added #882

Merged
merged 4 commits into from
Oct 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions src/components/Tutorials/subComps/TutorialTitle.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import Tooltip from "@mui/material/Tooltip";
import Grid from "@mui/material/Grid";
import QueryBuilderIcon from "@mui/icons-material/QueryBuilder";
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 @@ -13,8 +16,16 @@ const TutorialHeading = ({
tutorialData,
timeRemaining
}) => {
let [Fullscreen, setFullscreen] = useState(false);

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

let styleProps = {
Expand Down Expand Up @@ -50,16 +61,25 @@ const TutorialHeading = ({
{timeRemaining} mins remaining
</span>
</Button>
<Tooltip placement="left" title={"Go Fullscreen"}>
{Fullscreen ? <Tooltip placement="left" title={"exit Fullscreen"}>
<Button
type="dashed"
onClick={toggleFullscreen}
className="bp-8"
style={{ ...styleProps }}
>
<FullscreenExitIcon />
</Button>
</Tooltip>:<Tooltip placement="left" title={"Go Fullscreen"}>
<Button
type="dashed"
onClick={ toggleFullscreen}
className="bp-8"
style={{ ...styleProps }}
>
<FullscreenIcon />
</Button>
</Tooltip>
</Tooltip>}
</Grid>
</>
)}
Expand Down
Loading