id fix
Some checks failed
Create and publish a Docker image / Publish image (push) Failing after 27s
Create and publish a Docker image / Deploy image (push) Has been skipped

This commit is contained in:
VITALY-VORON 2023-08-24 21:35:44 +03:00
parent 4c651d6835
commit 9e6204b45e
3 changed files with 38 additions and 32 deletions

View File

@ -12,7 +12,6 @@ const Start = (props) => {
flexWrap: 'wrap', flexWrap: 'wrap',
justifyContent: 'space-between', justifyContent: 'space-between',
height: '95vh', height: '95vh',
backgroundImage: '../../data/img/Rectangle 27.png',
}}> }}>
<img src="" alt="Icon"/> <img src="" alt="Icon"/>
<button onClick={() => route('/')}>Начать</button> <button onClick={() => route('/')}>Начать</button>

View File

@ -1,5 +1,3 @@
/* Tinder.css */
.tinder-container { .tinder-container {
margin-top: 30%; margin-top: 30%;
height: 50vh; height: 50vh;
@ -9,7 +7,7 @@
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
overflow: hidden; overflow: hidden;
background-color: #fff;
} }
.card-container { .card-container {
@ -18,6 +16,7 @@
height: 80px; height: 80px;
width: 120px; width: 120px;
flex-direction: column; flex-direction: column;
background-color: #fff;
} }
.swipe { .swipe {
@ -50,13 +49,14 @@
flex-direction: column; flex-direction: column;
justify-content: flex-end; justify-content: flex-end;
align-items: flex-end; align-items: flex-end;
align-content: center;
flex-wrap: wrap;
padding: 16px; padding: 16px;
box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.1); box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.1);
background-color: #fff;
} }
.card-content { .card-content {
background-color: rgba(255, 255, 255, 0.8);
border-radius: 10px; border-radius: 10px;
padding: 8px; padding: 8px;
text-align: center; text-align: center;

View File

@ -4,60 +4,67 @@ import './Tinder.css'
const db = [ const db = [
{ {
name: 'Richard Hendricks', id: 1,
url: './img/richard.jpg' name: 'Richard Hendricks',
url: './img/richard.jpg'
}, },
{ {
name: 'Erlich Bachman', id: 2,
url: './img/erlich.jpg' name: 'Erlich Bachman',
url: './img/erlich.jpg'
}, },
{ {
name: 'Monica Hall', id: 3,
url: './img/monica.jpg' name: 'Monica Hall',
url: './img/monica.jpg'
}, },
{ {
name: 'Jared Dunn', id: 4,
url: './img/jared.jpg' name: 'Jared Dunn',
url: './img/jared.jpg'
}, },
{ {
name: 'Dinesh Chugtai', id: 5,
url: './img/dinesh.jpg' name: 'Dinesh Chugtai',
url: './img/dinesh.jpg'
} }
] ]
const Tinder = () => { const Tinder = () => {
const characters = db; const characters = db;
const [lastDirection, setLastDirection] = useState(); const [lastDirection, setLastDirection] = useState();
const [cardId, setCardId] = useState([]);
const swiped = (direction, nameToDelete) => { const swiped = (direction, nameToDelete, id) => {
console.log('removing: ' + nameToDelete); console.log('removing: ' + nameToDelete);
setLastDirection(direction); setLastDirection(direction);
if (direction === 'right') {
cardId.push(id);
};
console.log(cardId);
}; };
const outOfFrame = (name) => { const outOfFrame = (name) => {
console.log(name + ' left the screen!'); console.log(name + ' left the screen!');
}; };
let uniqueTags = [];
const getId = () => {
uniqueTags = cardId.filter(function(elem, pos) {
return cardId.indexOf(elem) === pos;
})
console.log(uniqueTags)
}
return ( return (
<div className='tinder-container'> <div className='tinder-container'>
{/* <div style={{
display: 'flex',
flexDirection: 'column',
height: '100%',
width: '100%',
alignContent: 'center',
flexWrap: 'wrap',
justifyContent: 'space-evenly',
alignItems: 'center',
background: 'white',
}}> */}
<h1>Card</h1> <h1>Card</h1>
<div className='card-container'> <div className='card-container'>
{characters.map((character) => ( {characters.map((character) => (
<TinderCard <TinderCard
className='swipe' className='swipe'
key={character.name} key={character.id}
onSwipe={(dir) => swiped(dir, character.name)} onSwipe={(dir) => swiped(dir, character.name, character.id)}
onCardLeftScreen={() => outOfFrame(character.name)} onCardLeftScreen={() => outOfFrame(character.name)}
> >
<div className='card'> <div className='card'>
@ -74,10 +81,10 @@ const db = [
{lastDirection ? ( {lastDirection ? (
<h2 className='infoText'>You swiped {lastDirection}</h2> <h2 className='infoText'>You swiped {lastDirection}</h2>
) : ( ) : (
<h2 className='infoText' /> null
)} )}
<button onClick={() => getId()}>Вывести массив</button>
</div> </div>
// </div>
); );
}; };