learn-morse-code/src/app-modes/PracticeMode.js

29 lines
978 B
JavaScript
Raw Normal View History

import React, {useContext} from 'react';
2020-01-09 10:06:38 +01:00
import '../css/App.css';
import {KeyTypeContext} from "../contexts/keyTypeContext"
import StraightKey from '../components/StraightKey'
import ElectronicKey from '../components/ElectronicKey'
2020-01-09 10:06:38 +01:00
import MorseBufferDisplay from '../components/MorseBufferDisplay'
2020-01-19 04:35:11 +01:00
import MorseHistory from '../components/MorseHistory'
2020-01-25 21:23:47 +01:00
import { WPMContext } from '../contexts/wpmContext';
import { GameModeContext } from '../contexts/gameModeContext';
import useStraightKey from '../hooks/useStraightKey';
2020-01-09 10:06:38 +01:00
export default React.memo(function PracticeMode() {
const {keyType} = useContext(KeyTypeContext)
2020-01-25 21:23:47 +01:00
const {gameMode} = useContext(GameModeContext)
const {wpm} = useContext(WPMContext)
2020-01-09 10:06:38 +01:00
return (
<>
2020-01-25 21:23:47 +01:00
{keyType === "straight" ? <StraightKey gameMode={gameMode} wpm={wpm} /> : <ElectronicKey gameMode={gameMode} wpm={wpm} />}
<MorseBufferDisplay /><br/>
2020-01-25 21:23:47 +01:00
<MorseHistory /><br/>
2020-01-09 10:06:38 +01:00
</>
);
})