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',
justifyContent: 'space-between',
height: '95vh',
backgroundImage: '../../data/img/Rectangle 27.png',
}}>
<img src="" alt="Icon"/>
<button onClick={() => route('/')}>Начать</button>

View File

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

View File

@ -4,60 +4,67 @@ import './Tinder.css'
const db = [
{
name: 'Richard Hendricks',
url: './img/richard.jpg'
id: 1,
name: 'Richard Hendricks',
url: './img/richard.jpg'
},
{
name: 'Erlich Bachman',
url: './img/erlich.jpg'
id: 2,
name: 'Erlich Bachman',
url: './img/erlich.jpg'
},
{
name: 'Monica Hall',
url: './img/monica.jpg'
id: 3,
name: 'Monica Hall',
url: './img/monica.jpg'
},
{
name: 'Jared Dunn',
url: './img/jared.jpg'
id: 4,
name: 'Jared Dunn',
url: './img/jared.jpg'
},
{
name: 'Dinesh Chugtai',
url: './img/dinesh.jpg'
id: 5,
name: 'Dinesh Chugtai',
url: './img/dinesh.jpg'
}
]
const Tinder = () => {
const characters = db;
const [lastDirection, setLastDirection] = useState();
const [cardId, setCardId] = useState([]);
const swiped = (direction, nameToDelete) => {
const swiped = (direction, nameToDelete, id) => {
console.log('removing: ' + nameToDelete);
setLastDirection(direction);
if (direction === 'right') {
cardId.push(id);
};
console.log(cardId);
};
const outOfFrame = (name) => {
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 (
<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>
<div className='card-container'>
{characters.map((character) => (
<TinderCard
className='swipe'
key={character.name}
onSwipe={(dir) => swiped(dir, character.name)}
key={character.id}
onSwipe={(dir) => swiped(dir, character.name, character.id)}
onCardLeftScreen={() => outOfFrame(character.name)}
>
<div className='card'>
@ -74,10 +81,10 @@ const db = [
{lastDirection ? (
<h2 className='infoText'>You swiped {lastDirection}</h2>
) : (
<h2 className='infoText' />
null
)}
<button onClick={() => getId()}>Вывести массив</button>
</div>
// </div>
);
};