Skip to content

Commit

Permalink
Toggle Fullscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
Dean Sofer authored and Dean Sofer committed May 17, 2024
1 parent 7608d5a commit bbd7c86
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/Game/Toolbar.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#toolbar {
a {
font-weight: bold;
font-size: 40px;
}
}
13 changes: 13 additions & 0 deletions src/Game/Toolbar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { useCallback } from 'react'
import './Toolbar.css'
export default function Toolbar() {
const toggleFullscreen = useCallback(() => {
if (document.fullscreenElement)
document.exitFullscreen()
else
document.documentElement.requestFullscreen()
}, [])
return <div id="toolbar">
<a onClick={toggleFullscreen}>&#x26F6;</a>
</div>
}
3 changes: 2 additions & 1 deletion src/Game/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import './Game.css';
import Dice from './Dice';
import Point from './Point';
import Piece from './Piece';
import Toolbar from './Toolbar';
import { useCallback, useState, type DragEventHandler } from 'react';


Expand Down Expand Up @@ -91,7 +92,7 @@ export default function Game() {
}, [move])

return <div id="board">
<div id="toolbar"></div>
<Toolbar />
<Dice onClick={roll} values={dice} />

<div className="bar">
Expand Down
1 change: 1 addition & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
color: #213547;
background-color: #242424;
background-color: #ffffff;
font-synthesis: none;
Expand Down

0 comments on commit bbd7c86

Please sign in to comment.