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

View File

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