File size: 547 Bytes
ece5841 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import React from 'react'
import PropTypes from 'prop-types';
import { Box } from '@mantine/core';
import useCountDown from '../../hooks/useCountDown'
const Timer = ({ on }) => {
// const { isTimerOn } = useContext(ChessGameContext)
const timeLimit = localStorage.getItem('timeLimit');
const [seconds, minutes] = useCountDown(timeLimit, on);
return (
<Box ff='monospace' sx={{ fontSize: '30px' }}>
{minutes}:{seconds}
</Box>
)
}
Timer.propTypes = {
on: PropTypes.bool
}
export default Timer |