import userEvent from '@testing-library/user-event' import React, { Component, useState, useRef, useEffect } from 'react' import './App.css' // import Header from './components/Header'; // import Navbar from './components/Navbar'; // import Profile from './components/Profile'; const Input = () => { const [value, setValue] = useState('asdf') return ( <> setValue(e.target.value)}/>

{value.toUpperCase()}

) } const Spoiler = ({children, header:Header}) => { const [show, setShow] = useState(false) return ( <>
setShow(!show)}/> {show && children} ) } const RangeInput = ({min, max}) => { const [value, setValue] = useState("notRed") return ( <> max) ? 'red' : 'white' }} onChange={e => { setValue(e.target.value); }}/> ) } const PasswordConfirm = ({min}) => { const [firstPass, setValue] = useState("123"); const [secondPass, setsecValue] = useState("123"); const [color, setColorValue] = useState("red"); const checkPassword = (newVal, confirmVal) => { return (newVal.length > min && confirmVal.length > min && newVal == confirmVal) ? "green" : "red"; } return ( <>

{color}

{ setValue(e.target.value); setColorValue(checkPassword(e.target.value, secondPass)); }} /> { setsecValue(e.target.value); setColorValue(checkPassword(e.target.value, firstPass)); }}/> ) } const Timer = ({sec}) => { var h = Math.floor(sec / 3600); var m = Math.floor(sec % 3600 / 60); var s = Math.floor(sec % 3600 % 60); const [count, changeCount] = useState(`${h}: ${m}: ${s}`); const [lock, closer] = useState(true); const [onOff, turning] = useState(false); const countRef = useRef(onOff); return ( <>

Timer {count}

) } const TimerControl = ({}) => { const [hours, setHours] = useState("1"); const [minutes, setMinutes] = useState("1"); const [sec, setSec] = useState("1"); const [buttOn, turnOnOff] = useState(true); const [countDownSown, show] = useState(false); const checkNumbers = (newVal, confirmVal) => { return (confirmVal.includes(".") || newVal.includes(".") || newVal < 0 || +confirmVal < 0 || +newVal > 60 || +confirmVal > 60) ? turnOnOff(false) : turnOnOff(true); } return ( <>

Timer Control

{ setHours(e.target.value)}}/> 59) || minutes.includes(".") ? 'red' : 'white' }} onChange={(e) => { setMinutes(e.target.value); checkNumbers(e.target.value, sec)}}/> 59) || (sec.includes(".")) ? 'red' : 'white' }} onChange={(e) => { setSec(e.target.value); checkNumbers(e.target.value, minutes)}}/>
{ countDownSown && }
) } const SecondsTimer = ({seconds}) =>

{seconds}

; const TimerContainer = ({seconds, refresh, render}) => { const Render = render; const [count, setCount] = useState(300); useEffect(() => { var firstState = Date.now() var secCounter; var interval = setInterval(() => { secCounter = seconds - (Math.floor((Date.now()/1000) - firstState/1000)); setCount(secCounter); if (secCounter < 0) { setCount(0) return clearInterval(interval) } }, refresh); }, []); return ( <> ) } const Timer2 = ({seconds}) => { var h = Math.floor(seconds / 3600); var m = Math.floor(seconds % 3600 / 60); var s = Math.floor(seconds % 3600 % 60); return ( <>

Timer {`${h}: ${m}: ${s}`}

) } const Watches = ({seconds}) => { var h = Math.floor(seconds / 3600) * 30; var m = Math.floor(seconds % 3600 / 60) * (360 / 60); var s = Math.floor(seconds % 3600 % 60) * (360 / 60); return ( <>
) } const TimerContainerControl = ({refresh, render}) => { const [hours, setHours] = useState("1"); const [minutes, setMinutes] = useState("1"); const [sec, setSec] = useState("1"); const [buttOn, turnOnOff] = useState(true); const [countDownSown, show] = useState(false); const [msc, letsCount] = useState("0"); const Render = render; const checkNumbers = (newVal, confirmVal) => { return (confirmVal.includes(".") || newVal.includes(".") || newVal < 0 || +confirmVal < 0 || +newVal > 60 || +confirmVal > 60) ? turnOnOff(false) : turnOnOff(true); } useEffect(() => { if (!countDownSown) { return clearInterval(interval) } var firstState = Date.now() var secCounter; var interval = setInterval(() => { secCounter = msc + (Math.floor((Date.now()/1000) - firstState/1000)); letsCount(secCounter); }, refresh); }, [countDownSown]); return ( <>

Timer Control

{ setHours(e.target.value)}}/> 59) || minutes.includes(".") ? 'red' : 'white' }} onChange={(e) => { setMinutes(e.target.value); checkNumbers(e.target.value, sec)}}/> 59) || (sec.includes(".")) ? 'red' : 'white' }} onChange={(e) => { setSec(e.target.value); checkNumbers(e.target.value, minutes)}}/>
{ countDownSown && }
) } const App = () => { return ( <>

Show

}> }>

Range Input

Timer Container

LSD

Watches + containerControl

); } export default App;