├── src
├── App.css
├── setupTests.js
├── components
│ ├── Header.css
│ ├── Chat.css
│ ├── TinderCard.css
│ ├── Chat.js
│ ├── SwipeButtons.css
│ ├── ChatScreen.css
│ ├── SwipeButtons.js
│ ├── Header.js
│ ├── TinderCards.js
│ ├── Chats.js
│ └── ChatScreen.js
├── reportWebVitals.js
├── index.css
├── index.js
├── firebase.js
└── App.js
├── public
├── robots.txt
├── favicon.ico
├── logo192.png
├── logo512.png
├── manifest.json
└── index.html
├── .gitignore
├── package.json
└── README.md
/src/App.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SashenJayathilaka/TINDER-Clone/HEAD/public/favicon.ico
--------------------------------------------------------------------------------
/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SashenJayathilaka/TINDER-Clone/HEAD/public/logo192.png
--------------------------------------------------------------------------------
/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SashenJayathilaka/TINDER-Clone/HEAD/public/logo512.png
--------------------------------------------------------------------------------
/src/setupTests.js:
--------------------------------------------------------------------------------
1 | // jest-dom adds custom jest matchers for asserting on DOM nodes.
2 | // allows you to do things like:
3 | // expect(element).toHaveTextContent(/react/i)
4 | // learn more: https://github.com/testing-library/jest-dom
5 | import '@testing-library/jest-dom';
6 |
--------------------------------------------------------------------------------
/src/components/Header.css:
--------------------------------------------------------------------------------
1 | .header {
2 | display: flex;
3 | justify-content: space-between;
4 | align-items: center;
5 | border-bottom: 1px solid #f9f9f9;
6 | }
7 |
8 | .header__image {
9 | height: 40px;
10 | object-fit: contain;
11 | }
12 |
13 | .headerIcons {
14 | padding: 20px;
15 | cursor: pointer;
16 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/src/reportWebVitals.js:
--------------------------------------------------------------------------------
1 | const reportWebVitals = onPerfEntry => {
2 | if (onPerfEntry && onPerfEntry instanceof Function) {
3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4 | getCLS(onPerfEntry);
5 | getFID(onPerfEntry);
6 | getFCP(onPerfEntry);
7 | getLCP(onPerfEntry);
8 | getTTFB(onPerfEntry);
9 | });
10 | }
11 | };
12 |
13 | export default reportWebVitals;
14 |
--------------------------------------------------------------------------------
/src/index.css:
--------------------------------------------------------------------------------
1 | * {
2 | margin: 0;
3 | }
4 | body {
5 | margin: 0;
6 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
7 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
8 | sans-serif;
9 | -webkit-font-smoothing: antialiased;
10 | -moz-osx-font-smoothing: grayscale;
11 | }
12 |
13 | code {
14 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
15 | monospace;
16 | }
--------------------------------------------------------------------------------
/src/components/Chat.css:
--------------------------------------------------------------------------------
1 | .chat {
2 | display: flex;
3 | align-items: center;
4 | justify-content: space-between;
5 | padding: 20px;
6 | height: 70px;
7 | border-bottom: 1px solid #fafafa;
8 | cursor: pointer;
9 | }
10 |
11 | a {
12 | text-decoration: none;
13 | color: inherit;
14 | }
15 |
16 | .chat__details {
17 | flex: 1;
18 | }
19 |
20 | .chat__details>p {
21 | color: gray;
22 | }
23 |
24 | .chat__timestamp {
25 | color: lightgray;
26 | }
27 |
28 | .chat__image {
29 | margin-right: 20px;
30 | }
--------------------------------------------------------------------------------
/src/components/TinderCard.css:
--------------------------------------------------------------------------------
1 | .card {
2 | position: relative;
3 | width: 600px;
4 | padding: 20px;
5 | max-width: 85vw;
6 | height: 50vh;
7 | border-radius: 20px;
8 | background-size: cover;
9 | background-position: center;
10 | box-shadow: 0px 18px 53px 0px rgba(0, 0, 0, 0.3);
11 | }
12 |
13 | .card > h3 {
14 | position: absolute;
15 | bottom: 10px;
16 | color: #fff;
17 | }
18 |
19 | .card__container {
20 | display: flex;
21 | justify-content: center;
22 | margin-top: 5vh;
23 | }
24 |
25 | .swipe {
26 | position: absolute;
27 | }
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom/client';
3 | import './index.css';
4 | import App from './App';
5 | import reportWebVitals from './reportWebVitals';
6 |
7 | const root = ReactDOM.createRoot(document.getElementById('root'));
8 | root.render(
9 |
10 |
11 |
12 | );
13 |
14 | // If you want to start measuring performance in your app, pass a function
15 | // to log results (for example: reportWebVitals(console.log))
16 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
17 | reportWebVitals();
18 |
--------------------------------------------------------------------------------
/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/src/components/Chat.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { Avatar } from '@material-ui/core'
3 | import './Chat.css'
4 | import { Link } from 'react-router-dom'
5 |
6 | const Chat = ({name, message, profilePic, timestamp}) => {
7 | return (
8 |
9 |
10 |
11 |
12 |
{name}
13 |
{message}
14 |
15 | {timestamp}
16 |
17 |
18 | )
19 | }
20 |
21 | export default Chat
--------------------------------------------------------------------------------
/src/firebase.js:
--------------------------------------------------------------------------------
1 | import firebase from 'firebase/compat/app';
2 | import 'firebase/compat/auth';
3 | import 'firebase/compat/firestore';
4 |
5 |
6 |
7 | // For Firebase JS SDK v7.20.0 and later, measurementId is optional
8 | const firebaseConfig = {
9 | apiKey: "AIzaSyAiUXK_0qv_UIsabR_AdLvjpnn7q9e4KUA",
10 | authDomain: "tinder-clone-ce8d7.firebaseapp.com",
11 | projectId: "tinder-clone-ce8d7",
12 | storageBucket: "tinder-clone-ce8d7.appspot.com",
13 | messagingSenderId: "1011891498066",
14 | appId: "1:1011891498066:web:a9bfa9fba4ddb386f7c38b",
15 | measurementId: "G-1XSRG7G0TT"
16 | };
17 |
18 | const firebaseApp = firebase.initializeApp(firebaseConfig);
19 | const database = firebaseApp.firestore();
20 |
21 | export default database;
--------------------------------------------------------------------------------
/src/components/SwipeButtons.css:
--------------------------------------------------------------------------------
1 | .swipe__Button {
2 | position: fixed;
3 | bottom: 10vh;
4 | display: flex;
5 | width: 100%;
6 | justify-content: space-evenly;
7 | cursor: pointer;
8 | }
9 |
10 | .swipe__Button .MuiIconButton-root{
11 | background-color: #fff;
12 | box-shadow: 0px 10px 53px 0px rgba(0, 0, 0, 0.3) !important;
13 | }
14 |
15 | .swipeButton__repeat {
16 | padding: 3vw !important;
17 | color: #f5b748 !important;
18 | }
19 | .swipeButton__left {
20 | padding: 3vw !important;
21 | color: #ec5e6f !important;
22 | }
23 | .swipeButton__star {
24 | padding: 3vw !important;
25 | color: #62b4f9 !important;
26 | }
27 | .swipeButton__right {
28 | padding: 3vw !important;
29 | color: #76e2b3 !important;
30 | }
31 | .swipeButton__flashOn {
32 | padding: 3vw !important;
33 | color: #915dd1 !important;
34 | }
--------------------------------------------------------------------------------
/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
3 | import './App.css';
4 | import Chats from './components/Chats';
5 | import ChatScreen from './components/ChatScreen';
6 | import Header from './components/Header';
7 | import SwipeButtons from './components/SwipeButtons';
8 | import TinderCards from './components/TinderCards';
9 |
10 | function App() {
11 | return (
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 | );
32 | }
33 |
34 | export default App;
35 |
--------------------------------------------------------------------------------
/src/components/ChatScreen.css:
--------------------------------------------------------------------------------
1 | .chatScreen__message {
2 | display: flex;
3 | align-items: center;
4 | padding: 20px;
5 | }
6 |
7 | .chatScreen__text {
8 | margin-left: 10px;
9 | background-color: lightgray;
10 | padding: 15px;
11 | border-radius: 20px;
12 | }
13 |
14 | .chatScreen__timestamp {
15 | text-align: center;
16 | padding: 20px;
17 | color: gray;
18 | }
19 |
20 | .chatScreen__textUser {
21 | margin-left: auto;
22 | background-color: #29b3cd;
23 | padding: 15px;
24 | border-radius: 20px;
25 | color: #fff;
26 | }
27 |
28 | .chatScreen__input {
29 | display: flex;
30 | padding: 5px;
31 | position: fixed;
32 | bottom: 0;
33 | width: 100%;
34 | border-top: 1px solid lightgray;
35 | }
36 |
37 | .chaScreen__inputFeal {
38 | flex: 1;
39 | padding: 10px;
40 | border: none;
41 | }
42 |
43 | .chatScreen__inputButton {
44 | border: none;
45 | margin-right: 20px;
46 | background-color: #fff;
47 | font-weight: bolder;
48 | color: #fe3d71;
49 | cursor: pointer;
50 | }
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "tinder_clone",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@material-ui/core": "^4.12.4",
7 | "@material-ui/icons": "^4.11.3",
8 | "@testing-library/jest-dom": "^5.16.4",
9 | "@testing-library/react": "^13.3.0",
10 | "@testing-library/user-event": "^13.5.0",
11 | "firebase": "^9.9.0",
12 | "react": "^18.2.0",
13 | "react-dom": "^18.2.0",
14 | "react-router-dom": "^5.3.3",
15 | "react-scripts": "5.0.1",
16 | "react-tinder-card": "^1.4.5",
17 | "web-vitals": "^2.1.4"
18 | },
19 | "scripts": {
20 | "start": "react-scripts start",
21 | "build": "react-scripts build",
22 | "test": "react-scripts test",
23 | "eject": "react-scripts eject"
24 | },
25 | "eslintConfig": {
26 | "extends": [
27 | "react-app",
28 | "react-app/jest"
29 | ]
30 | },
31 | "browserslist": {
32 | "production": [
33 | ">0.2%",
34 | "not dead",
35 | "not op_mini all"
36 | ],
37 | "development": [
38 | "last 1 chrome version",
39 | "last 1 firefox version",
40 | "last 1 safari version"
41 | ]
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/components/SwipeButtons.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import ReplayIcon from '@material-ui/icons/Replay';
3 | import CloseIcon from '@material-ui/icons/Close';
4 | import StarRateIcon from '@material-ui/icons/StarRate';
5 | import FavoriteIcon from '@material-ui/icons/Favorite';
6 | import FlashOnIcon from '@material-ui/icons/FlashOn';
7 | import { IconButton } from '@material-ui/core';
8 | import './SwipeButtons.css'
9 |
10 | const SwipeButtons = () => {
11 | return (
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | )
30 | }
31 |
32 | export default SwipeButtons
--------------------------------------------------------------------------------
/src/components/Header.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import PersonIcon from '@material-ui/icons/Person';
3 | import ForumIcon from '@material-ui/icons/Forum';
4 | import { IconButton } from '@material-ui/core';
5 | import ArrowBackIosIcon from '@material-ui/icons/ArrowBackIos';
6 | import './Header.css'
7 | import { Link, useHistory } from 'react-router-dom';
8 |
9 | function Header({ backButton }) {
10 |
11 | const history = useHistory();
12 |
13 | return (
14 |
15 | {backButton ? (
16 |
history.replace(backButton)}>
17 |
18 |
19 |
20 | ) : (
21 |
22 |
23 |
24 | )}
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | )
35 | }
36 |
37 | export default Header
--------------------------------------------------------------------------------
/src/components/TinderCards.js:
--------------------------------------------------------------------------------
1 | import React, { useEffect, useState } from 'react'
2 | import TinderCard from 'react-tinder-card';
3 | import database from '../firebase';
4 | import './TinderCard.css'
5 |
6 | function TinderCards() {
7 |
8 | const [people, setPeople] = useState([]);
9 |
10 | useEffect(() => {
11 | // this is where the code run ...
12 | const unSubscribe = database.collection('people').onSnapshot(snapshot => (
13 | setPeople(snapshot.docs.map(doc => doc.data()))
14 | ));
15 | return () => {
16 | // cleanUp
17 | unSubscribe()
18 | }
19 | }, [])
20 | //console.log(people);
21 |
22 | // Bad
23 | // const people =[];
24 | // people.push('sashen', 'hasindu')
25 |
26 | // Good
27 | // setPeople([...people, 'sashen', 'hasindu'])
28 |
29 | return (
30 |
31 |
32 | {people.map(person => (
33 |
34 |
35 |
{person.name}
36 |
37 |
38 | ))}
39 |
40 |
41 | )
42 | }
43 |
44 | export default TinderCards
--------------------------------------------------------------------------------
/src/components/Chats.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import Chat from './Chat'
3 |
4 | function Chats() {
5 | return (
6 |
7 |
13 |
18 |
23 |
28 |
33 |
34 | )
35 | }
36 |
37 | export default Chats
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
17 |
18 |
27 | TINDER Clone
28 |
29 |
30 | You need to enable JavaScript to run this app.
31 |
32 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/src/components/ChatScreen.js:
--------------------------------------------------------------------------------
1 | import { Avatar } from '@material-ui/core';
2 | import React, { useState } from 'react'
3 | import './ChatScreen.css'
4 |
5 | const ChatScreen = () => {
6 |
7 | const [input, setInput] = useState('');
8 |
9 | const [messages, setMessages] = useState([
10 | {
11 | name: 'Ellen',
12 | image: 'https://cdn2.vectorstock.com/i/1000x1000/20/76/man-avatar-profile-vector-21372076.jpg',
13 | message: 'Hey Guys!'
14 | },
15 | {
16 | name: 'Ellen',
17 | image: 'https://cdn2.vectorstock.com/i/1000x1000/20/76/man-avatar-profile-vector-21372076.jpg',
18 | message: 'Chat guys😎'
19 | },
20 | {
21 | message: 'Hey bro This is Grate😍💛'
22 | }
23 | ]);
24 |
25 | const handleSend = e => {
26 | e.preventDefault();
27 |
28 | setMessages([...messages, {message: input}]);
29 | setInput("");
30 | }
31 |
32 | return (
33 |
34 |
You match with ellen on 10/08/2021
35 |
36 | {messages.map(message => (
37 | message.name ? (
38 |
39 |
44 |
{message.message}
45 |
46 | ) : (
47 |
48 |
{message.message}
49 |
50 | )
51 |
52 | ))}
53 |
54 |
58 |
59 |
60 | )
61 | }
62 |
63 | export default ChatScreen
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # TINDER Clone with REACT JS
2 | ### 🔴 LIVE DEMO
3 |
4 | #### PREREQUISITES:
5 | - Sign up for a Firebase account HERE
6 | - Install Node JS in your computer HERE
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
17 |
18 | ## Available Scripts
19 |
20 | ```
21 | npx create-react-app tinder_clone
22 | ```
23 |
24 | In the project directory, you can run:
25 | ```
26 | npm start
27 | ```
28 |
29 | Runs the app in the development mode.\
30 | Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
31 |
32 | The page will reload when you make changes.\
33 | You may also see any lint errors in the console.
34 | ```
35 | npm test
36 | ```
37 |
38 | Launches the test runner in the interactive watch mode.\
39 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
40 | ```
41 | npm run build
42 | ```
43 |
44 | Builds the app for production to the `build` folder.\
45 | It correctly bundles React in production mode and optimizes the build for the best performance.
46 |
47 | The build is minified and the filenames include the hashes.\
48 | Your app is ready to be deployed!
49 |
50 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
51 | ```
52 | npm run eject
53 | ```
54 |
55 | **Note: this is a one-way operation. Once you `eject`, you can't go back!**
56 |
57 | If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
58 |
59 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
60 |
61 | You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
62 |
63 |
64 |
65 |
66 | ```
67 | npm i react-tinder-card
68 | ```
69 | ```
70 | npm install react react-dom
71 | ```
72 |
73 | ## Available MATERIAL-UI Scripts
74 | MATERIAL-UI HERE
75 | ```
76 | npm install -f @material-ui/core
77 | ```
78 | ```
79 | npm install -f @material-ui/icons
80 | ```
81 | ## Available MATERIAL-UI Scripts
82 | ```
83 | npm install firebase
84 | ```
85 | ```
86 | npm install -g firebase-tools
87 | ```
88 | More HERE
89 | ```
90 | firebase init hosting
91 | ```
92 | ```
93 | npm run build
94 | ```
95 | ```
96 | firebase deploy
97 | ```
98 |
103 |
--------------------------------------------------------------------------------