This commit is contained in:
2022-02-03 19:30:24 -03:00
parent d5beb455ff
commit 72e3a0608f
3 changed files with 53 additions and 34 deletions

View File

@@ -10,9 +10,8 @@ import {
Link
} from "react-router-dom";
import Crypto from './components/Crypto/Crypto';
import Header from './components/Header/Header';
import Background from './components/Background/Background';
import Cryptos from './components/CryptoGallery/CryptoGallery';
import CryptoGalleryContainer from './components/CryptoGallery/CryptoGalleryContainer'
function App() {
@@ -21,25 +20,8 @@ function App() {
background-image: radial-gradient( circle farthest-corner at 12.3% 19.3%, rgba(85,88,218,1) 0%, rgba(95,209,249,1) 100.2% );
`
const [loading, setLoading] = useState(true)
const [loadingURL, setLoadingURL] = useState('https://i.ibb.co/Dwygw0t/Logo-reduced.png')
React.useEffect(() => {
if (loading) {
document.body.style.overflow = "hidden"
} else {
setTimeout(() => {
document.body.style.overflow = "visible"
}, 2000);
} //https://stackoverflow.com/questions/39962757/prevent-scrolling-using-css-on-react-rendered-components
}, [loading])
const setLoadingURL = () => {}
const loadingURL = () => {}
return (
<GlobalStyles>
@@ -50,16 +32,7 @@ function App() {
<Crypto />
</Route>
<Route path="/">
<CryptoGalleryLoading loading={loading} loadingURL={loadingURL} setLoading={setLoading}/>
<Header />
<Background
loading={loading}
/>
<Cryptos
loading={loading}
setLoading={setLoading}
setLoadingURL={setLoadingURL}
/>
<CryptoGalleryContainer />
</Route>
</Switch>
</Router>

View File

@@ -5,7 +5,7 @@ import CryptoGalleryItem from './CryptoGalleryItem';
import moment from 'moment';
const Cryptos = ({setLoading, setLoadingURL, loading}) => {
const CryptoGallery = ({setLoading, setLoadingURL, loading}) => {
const CryptosStyles = styled.div`
@@ -243,4 +243,4 @@ const Cryptos = ({setLoading, setLoadingURL, loading}) => {
);
};
export default Cryptos;
export default CryptoGallery;

View File

@@ -0,0 +1,46 @@
import React, {useState} from 'react';
import Background from '../Background/Background';
import CryptoGalleryLoading from '../CryptoGalleryLoading/CryptoGalleryLoading';
import Header from '../Header/Header';
import CryptoGallery from './CryptoGallery';
const CryptoGalleryContainer = () => {
const [loading, setLoading] = useState(true)
const [loadingURL, setLoadingURL] = useState('https://i.ibb.co/Dwygw0t/Logo-reduced.png')
React.useEffect(() => {
if (loading) {
document.body.style.overflow = "hidden"
} else {
setTimeout(() => {
document.body.style.overflow = "visible"
}, 2000);
} //https://stackoverflow.com/questions/39962757/prevent-scrolling-using-css-on-react-rendered-components
}, [loading])
return (
<>
<CryptoGalleryLoading loading={loading} loadingURL={loadingURL} setLoading={setLoading}/>
<Header />
<Background
loading={loading}
/>
<CryptoGallery
loading={loading}
setLoading={setLoading}
setLoadingURL={setLoadingURL}
/>
</>
)
};
export default CryptoGalleryContainer;