This commit is contained in:
Vikeo
2025-02-23 23:43:24 +01:00
parent e7e5882859
commit 4130e069bb
2 changed files with 12 additions and 4 deletions

View File

@@ -1,6 +1,8 @@
import { useStopwatch } from 'react-timer-hook';
import { TimerStyle, TimerWrapper } from './Timer';
import { Time } from './Time';
import PlayArrowIcon from '@mui/icons-material/PlayArrow';
import PauseIcon from '@mui/icons-material/Pause';
export const NegativeStopWatch = ({
autoStart = false,
@@ -18,9 +20,16 @@ export const NegativeStopWatch = ({
{'-'}
<Time time={{ hours, minutes, seconds }} />
<div>
{/* Only show Start if the timer is not running */}
{!isRunning && <button onClick={start}>Start</button>}
{isRunning && <button onClick={pause}>Pause</button>}
{!isRunning && (
<button onClick={start}>
<PlayArrowIcon />
</button>
)}
{isRunning && (
<button onClick={pause}>
<PauseIcon />
</button>
)}
</div>
</TimerStyle>
</TimerWrapper>

View File

@@ -64,7 +64,6 @@ export const Timer = () => {
}}
/>
<div>
{/* Only show Start if the timer is not running */}
{!isRunning && (
<button onClick={handleStart}>
<PlayArrowIcon />