-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
52 lines (49 loc) · 1.25 KB
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import { useChronos } from './hooks/useChronos';
function App() {
const {
isActive,
isPaused,
led,
handleSetMinutes,
handleSetSeconds,
handleReset,
handleStart,
handleStop,
handleTestLed,
minutes,
seconds,
ms,
mm,
ss,
// isStartButtonDisable,
} = useChronos(0, 0);
return (
<div className='appContent'>
<div className='sliderContent'>
<span>{`🕗 ${mm}:${ss}:${ms}`}</span>
<input type='range' min='0' max='5' onChange={handleSetMinutes} value={minutes} />
<input type='range' min='0' max='60' onChange={handleSetSeconds} value={seconds} />
</div>
{!isActive ? (
<>
<button className='btnOutline' onClick={handleTestLed}>
{led ? '🟢 Led ON ' : '🔴 Led OFF'}
</button>
<button className='btnStart' onClick={handleStart}>
Start
</button>
</>
) : (
<div className='btnContent'>
<button className='btnOutline' onClick={handleReset}>
Reset
</button>
<button className='btnStart' onClick={handleStop}>
{isPaused ? 'Resume' : 'Pause'}
</button>
</div>
)}
</div>
);
}
export default App;