From 5cede13ca33f0e20aa12775b84110b79c9fa8873 Mon Sep 17 00:00:00 2001 From: VITALY-VORON <142410419+VITALY-VORON@users.noreply.github.com> Date: Fri, 25 Aug 2023 18:51:46 +0300 Subject: [PATCH] fix --- src/App.js | 22 +++++++++++++++++++--- src/components/Start/Start.js | 1 + src/components/Tinder/Tinder.css | 1 - src/components/Tinder/Tinder.js | 16 +--------------- src/setupTests.js | 0 5 files changed, 21 insertions(+), 19 deletions(-) create mode 100644 src/setupTests.js diff --git a/src/App.js b/src/App.js index c5584fc..2cce5c6 100644 --- a/src/App.js +++ b/src/App.js @@ -1,14 +1,16 @@ -import React, {useState} from 'react'; +import React, {useState, useEffect} from 'react'; import Start from './components/Start/Start'; import Second from './components/Second/Second'; import Tinder from './components/Tinder/Tinder'; import Map from './components/Map/Map'; -import './App.css' +import axios from 'axios'; +import './App.css'; function App() { const [buttonValue, setButtonValue] = useState(""); const [isHidden, setIsHidden] = useState(false); + const [cardInfo, setCardInfo] = useState([]); const handleButtonValue = (value) => { setIsHidden(true); @@ -18,13 +20,27 @@ function App() { }, 300); }; + useEffect(() => { + const fetchData = () => { + axios.get('https://easytravel.zetcraft.ru/v1/GetAllCards') + .then(response => { + setCardInfo(response.data); + console.log(cardInfo.length); + }) + .catch(error => { + console.error('Error fetching data:', error); + }); + } + fetchData(); + }, []); + let content = null; switch (buttonValue) { case '/': content = break; case '/tinder': - content = + content = break; case '/map': content = diff --git a/src/components/Start/Start.js b/src/components/Start/Start.js index c5bc440..27e2b25 100644 --- a/src/components/Start/Start.js +++ b/src/components/Start/Start.js @@ -12,6 +12,7 @@ const Start = (props) => { flexWrap: 'wrap', justifyContent: 'space-evenly', height: '95vh', + background: 'linear-gradient(180deg, #7EAFE7 0.27%, rgba(41, 134, 242, 0.38) 27.08%, rgba(41, 134, 242, 0.35) 31.77%, rgba(152, 198, 253, 0.28) 46.35%, rgba(41, 134, 242, 0.00) 100%)', overflow: 'hidden', }}> { const route = props.getValue; + const cardInfo = props.cardInfo; const [lastDirection, setLastDirection] = useState(); const [cardId, setCardId] = useState([]); const [allIds, setAllIds] = useState([]); - const [cardInfo, setCardInfo] = useState([]); - - useEffect(() => { - const fetchData = () => { - axios.get('https://easytravel.zetcraft.ru/v1/GetAllCards') - .then(response => { - setCardInfo(response.data); - console.log(cardInfo.length); - }) - .catch(error => { - console.error('Error fetching data:', error); - }); - } - fetchData(); - }, []); const swiped = (direction, id) => { setLastDirection(direction); diff --git a/src/setupTests.js b/src/setupTests.js new file mode 100644 index 0000000..e69de29