From 9e6204b45e98f3d49ccf8e10934d7a6a4c3f0698 Mon Sep 17 00:00:00 2001
From: VITALY-VORON <142410419+VITALY-VORON@users.noreply.github.com>
Date: Thu, 24 Aug 2023 21:35:44 +0300
Subject: [PATCH] id fix
---
src/components/Start/Start.js | 1 -
src/components/Tinder/Tinder.css | 10 +++---
src/components/Tinder/Tinder.js | 59 ++++++++++++++++++--------------
3 files changed, 38 insertions(+), 32 deletions(-)
diff --git a/src/components/Start/Start.js b/src/components/Start/Start.js
index e6bf0d7..4b2eee3 100644
--- a/src/components/Start/Start.js
+++ b/src/components/Start/Start.js
@@ -12,7 +12,6 @@ const Start = (props) => {
flexWrap: 'wrap',
justifyContent: 'space-between',
height: '95vh',
- backgroundImage: '../../data/img/Rectangle 27.png',
}}>
diff --git a/src/components/Tinder/Tinder.css b/src/components/Tinder/Tinder.css
index af195a4..89f063a 100644
--- a/src/components/Tinder/Tinder.css
+++ b/src/components/Tinder/Tinder.css
@@ -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;
diff --git a/src/components/Tinder/Tinder.js b/src/components/Tinder/Tinder.js
index 233564a..e0e2be8 100644
--- a/src/components/Tinder/Tinder.js
+++ b/src/components/Tinder/Tinder.js
@@ -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 (