<Route exact path='/contacts' Component={Contacts} />
// Component={Contacts} ???
import React from 'react';
import {BrowserRouter as Router, Routes, Route, Link} from 'react-router-dom';
import './App.scss';
import Header from './components/Header';
import Service from './pages/Service';
import Contacts from './pages/Contacts';
import Login from './pages/Login';
import Home from './pages/Home';
function App() {
return (
<Router>
<div className="App">
<Header />
<nav>
<Link to="/">Главная</Link>
<Link to="/service">Услуги</Link>
<Link to="/contacts">Контакты</Link>
<Link to="/login">Вход</Link>
</nav>
<Routes>
<Route path="/" element={<Home />} />
<Route path="/service" element={<Service />} />
<Route path="/contacts" element={<Contacts />} />
<Route path="/login" element={<Login />} />
<Route path="*" element={<NotFoundRoute/>} />
</Routes>
</div>
</Router>
);
}
// not fount route handler
function NotFoundRoute() {
return <div>Page not found</div>;
}
export default App;
import {Link} from "react-router-dom";
function Header(props) {
return (
<>
<header>
// ...
<Link to="/service">Услуги</Link>
<Link to="/contacts">Контакты</Link>
// ...
</header>
</>
)
}
export default Header;
let zSpacing = -1000,
lastPos = zSpacing / 5,
$frames = document.getElementsByClassName('frame'),
frames = Array.from($frames),
zVals = [];
const lastFrame = $frames[$frames.length - 1];
const lastFrameHeight = lastFrame.offsetHeight;
const lastFrameTop = lastFrame.offsetTop;
window.onscroll = function() {
let top = document.documentElement.scrollTop,
delta = lastPos - top
lastPos = top
frames.forEach(function(n, i) {
zVals.push((i * zSpacing) + zSpacing)
zVals[i] += delta * -5.5
let frame = frames[i],
transform = `translateZ(${zVals[i]}px)`,
opacity = zVals[i] < Math.abs(zSpacing) / 1.8 ? 1 : 0
frame.setAttribute('style', `transform: ${transform}; opacity: ${opacity};`);
});
if (top + window.innerHeight >= lastFrameTop + lastFrameHeight) {
window.scrollTo(0, lastFrameTop);
}
};
window.scrollTo(0, 1);
let soundbutton = document.querySelector('.soundbutton'),
audio = document.querySelector('.audio')
soundbutton.addEventListener('click', e =>{
soundbutton.classList.toggle('paused')
audio.paused ? audio.play() : audio.pause()
})
window.onfocus = function(){
soundbutton.classList.contains('paused') ? audio.pause() : audio.play()
}
window.onblur = function() {
audio.pause()
}
Почему Не работает код?- потому что на первом сайте внесли косметические изменения, добавили блоки и д.т.
# container = soup.find_all('div', class_='sppb-container-inner')
container = soup.select_one('div.sppb-row-container:nth-child(4) > div:nth-child(1)')
import requests
from bs4 import BeautifulSoup
url = 'https://koronavirusa.site/ru'
page = requests.get(url)
soup = BeautifulSoup(page.text, "html.parser")
container = soup.find('div', class_='sppb-container-inner')
data = container.find_all('div',class_='sppb-animated-number')
infected = data[0].text
died = data[1].text
healed = data[2].text
print(f'''Заражено: {infected}
Умерло: {died}
Выздоровело: {healed}''')
Заражено: 1,990,746
Умерло: 125,919
Выздоровело: 466,997