Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 | 1x 1x 5x 5x 30x 1x | import PropTypes from 'prop-types'
import {BASE_CLASSNAME} from './config.js'
import PinInputField from './PinInputField.js'
const CLASSNAME = `${BASE_CLASSNAME}FieldsWrapper`
const PinInputChildren = ({autoFocus = false, length, children}) => {
Iif (children) return children
return (
<div className={CLASSNAME}>
{Array(length)
.fill('')
.map((value, index) => (
<PinInputField key={index} autoFocus={Boolean(index === 0 && autoFocus)} />
))}
</div>
)
}
PinInputChildren.propTypes = {
/** boolean to autoFocus the first input */
autoFocus: PropTypes.bool,
/** number of input */
length: PropTypes.number,
/** children to be rendered */
children: PropTypes.node
}
export default PinInputChildren
|