import React from 'react'; import classnames from 'classnames'; import { translateRaw } from 'translations'; import './Word.scss'; interface Props { index: number; word: string; value: string; isReadOnly: boolean; onChange(index: number, value: string): void; } interface State { isShowingWord: boolean; } export default class MnemonicWord extends React.Component { public state = { isShowingWord: false }; public render() { const { index, word, value, isReadOnly } = this.props; const { isShowingWord } = this.state; const readOnly = isReadOnly || isShowingWord; return (
{index + 1}.
{!isReadOnly && ( )}
); } private handleChange = (ev: React.FormEvent) => { this.props.onChange(this.props.index, ev.currentTarget.value); }; private toggleShow = () => { this.setState({ isShowingWord: !this.state.isShowingWord }); }; }