You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.5 KiB
52 lines
1.5 KiB
7 years ago
|
import React from 'react'
|
||
|
import PropTypes from 'prop-types'
|
||
|
import styles from './ReEnterSeed.scss'
|
||
|
|
||
7 years ago
|
class ReEnterSeed extends React.Component {
|
||
|
componentWillMount() {
|
||
7 years ago
|
const { setReEnterSeedIndexes } = this.props
|
||
|
setReEnterSeedIndexes()
|
||
7 years ago
|
}
|
||
|
|
||
|
render() {
|
||
|
const { seed, reEnterSeedInput, updateReEnterSeedInput, seedIndexesArr } = this.props
|
||
|
|
||
|
return (
|
||
|
<div className={styles.container}>
|
||
|
<ul className={styles.seedContainer}>
|
||
|
{seedIndexesArr.map(index => (
|
||
|
<li key={index}>
|
||
|
<section>
|
||
|
<label htmlFor={index}>{index}</label>
|
||
|
</section>
|
||
|
<section>
|
||
|
<input
|
||
|
type="text"
|
||
|
id={index}
|
||
|
value={reEnterSeedInput[index] ? reEnterSeedInput[index] : ''}
|
||
|
onChange={event => updateReEnterSeedInput({ word: event.target.value, index })}
|
||
|
className={`${styles.word} ${
|
||
|
reEnterSeedInput[index] && seed[index - 1] === reEnterSeedInput[index]
|
||
|
? styles.valid
|
||
|
: styles.invalid
|
||
|
}`}
|
||
|
/>
|
||
|
</section>
|
||
|
</li>
|
||
|
))}
|
||
|
</ul>
|
||
|
</div>
|
||
|
)
|
||
|
}
|
||
|
}
|
||
7 years ago
|
|
||
7 years ago
|
ReEnterSeed.propTypes = {
|
||
7 years ago
|
seed: PropTypes.array.isRequired,
|
||
7 years ago
|
reEnterSeedInput: PropTypes.object.isRequired,
|
||
|
updateReEnterSeedInput: PropTypes.func.isRequired,
|
||
|
setReEnterSeedIndexes: PropTypes.func.isRequired,
|
||
|
seedIndexesArr: PropTypes.array.isRequired
|
||
7 years ago
|
}
|
||
|
|
||
|
export default ReEnterSeed
|