import React, {useState, useCallback, useRef, useEffect} from 'react'; import arrow from '../assets/36-arrow-right.svg'; import { MainWrapper, InputElement, InputLabel, InputWrapper, ArrowImg, IconButton, } from './style'; import { Journal } from './Journal'; const Input = ({ onStart }) => { const [value, setValue] = useState(''); const [inFocuse, setInfocuse] = useState(false); const handleChange = useCallback(event => { setValue(event.target.value.toUpperCase()) }, [setValue]); const inputRef = useRef(null); useEffect(() => { const pass = localStorage.getItem('pass') if (pass) { onStart(); } }, []); const handleSubmit = useCallback((event) => { event.preventDefault(); localStorage.setItem('pass', 'true') if (value === 'OYB0Y') { onStart() } }, [value]) return ( <>
Введите пароль: setInfocuse(true)} ref={inputRef} id="input" type="password" autoComplete="off" />
) } export const MainPage = () => { const [shoList, setShoList] = useState(false); return ( {!shoList && setShoList(true)} />} {shoList && } ); };