@@ -2,14 +2,41 @@ import React from 'react';
22import PropTypes from 'prop-types' ;
33import './styles/controls.scss' ;
44/* font awesome */
5- import { library } from '@fortawesome/fontawesome-svg-core' ;
65import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' ;
76import {
8- faPowerOff , faPause , faPlay , faUsers , faUser ,
7+ faUsers , faUser ,
98} from '@fortawesome/free-solid-svg-icons' ;
9+ import RestartAltIcon from '@mui/icons-material/RestartAlt' ;
10+ import IconButton from '@mui/material/IconButton' ;
11+ import PlayCircleFilledWhiteIcon from "@mui/icons-material/PlayCircleFilledWhite" ;
12+ import PauseIcon from "@mui/icons-material/Pause" ;
1013
11- /* adds font awesome icons */
12- library . add ( faPowerOff , faPause , faPlay ) ;
14+
15+ const PlayControls = ( { pauseButtonState, onhandlePause, onReset, disabled } ) => (
16+ < >
17+ < IconButton
18+ aria-label = "reset"
19+ size = "large"
20+ onClick = { ( ) => onReset ( false ) }
21+ disabled = { disabled }
22+ >
23+ < RestartAltIcon sx = { { fontSize : 52 , color : disabled ? 'grey' : 'rgb(59, 9, 153)' } } />
24+ </ IconButton >
25+ {
26+ pauseButtonState
27+ ? (
28+ < IconButton aria-label = "play" size = "large" onClick = { onhandlePause } disabled = { disabled } >
29+ < PlayCircleFilledWhiteIcon sx = { { fontSize : 52 , color : disabled ? 'grey' : 'green' } } />
30+ </ IconButton >
31+ )
32+ : (
33+ < IconButton aria-label = "play" size = "large" onClick = { onhandlePause } disabled = { disabled } >
34+ < PauseIcon sx = { { fontSize : 52 , color : disabled ? 'grey' : 'red' } } />
35+ </ IconButton >
36+ )
37+ }
38+ </ >
39+ )
1340
1441const Controls = ( {
1542 onhandlePause,
@@ -34,44 +61,27 @@ const Controls = ({
3461 tabIndex = "0"
3562 />
3663 < div className = "controls__resetPause" >
37- < FontAwesomeIcon
38- className = "controls__resetPause__reset"
39- icon = { faPowerOff }
40- onClick = { ( ) => onReset ( false ) }
64+ < PlayControls
65+ pauseButtonState = { pauseButtonState }
66+ onhandlePause = { onhandlePause }
67+ onReset = { onReset }
4168 />
42- {
43- pauseButtonState
44- ? (
45- < FontAwesomeIcon
46- className = "controls__resetPause__play"
47- icon = { faPlay }
48- onClick = { onhandlePause ( ) }
49- />
50- )
51- : (
52- < FontAwesomeIcon
53- className = "controls__resetPause__pause"
54- icon = { faPause }
55- onClick = { onhandlePause ( ) }
56- />
57- )
58- }
5969 </ div >
6070 {
6171 allowMultiPlayer
6272 ? (
6373 < FontAwesomeIcon
6474 className = "controls__multiplayer"
6575 icon = { faUsers }
66- onClick = { onMultiPlayer ( ) }
76+ onClick = { onMultiPlayer }
6777 />
6878 )
6979 : null
7080 }
7181 < button
7282 className = "controls__raise"
7383 type = "submit"
74- onClick = { ( ) => onFloorRaise ( ) }
84+ onClick = { onFloorRaise }
7585 >
7686 Raise Floor
7787 </ button >
@@ -93,17 +103,25 @@ const Controls = ({
93103 height = { game . canvas . canvasMinor . height }
94104 tabIndex = "0"
95105 />
106+ < div className = "controls__resetPause" >
107+ < PlayControls
108+ pauseButtonState = { pauseButtonState }
109+ onhandlePause = { onhandlePause }
110+ onReset = { onReset }
111+ disabled = { true }
112+ />
113+ </ div >
96114 {
97115 ! multiPlayer [ 1 ] ? (
98116 < FontAwesomeIcon
99117 className = "controls__multiplayer"
100118 icon = { faUser }
101- onClick = { onMultiPlayer ( ) }
119+ onClick = { onMultiPlayer }
102120 />
103121 )
104122 : null
105123 }
106-
124+ < div style = { { height : 40 } } > </ div >
107125 < span > Lines Cleared</ span >
108126 < span > { game . points . totalLinesCleared } </ span >
109127 < span > Difficulty</ span >
0 commit comments