├── .gitignore
├── README.md
├── craco.config.js
├── package-lock.json
├── package.json
├── public
├── favicon.ico
├── index.html
├── logo192.png
├── logo512.png
├── manifest.json
└── robots.txt
├── src
├── App.js
├── components
│ ├── Divider.js
│ ├── FeedItem.js
│ ├── FeedList.js
│ ├── SideLink.js
│ ├── TweetBox.js
│ └── UserBox.js
├── firebase.js
├── icons
│ └── Icon.js
├── images
│ └── twitter.svg
├── index.css
├── index.js
├── layout
│ ├── Container.js
│ ├── Content.js
│ ├── Sidebar.js
│ └── Widgets.js
└── reportWebVitals.js
└── tailwind.config.js
/.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 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Twitter Clone App For Youtube
2 |
3 | Youtube Tutorial Series For This Clone [Twitter Clone](https://youtube.com/playlist?list=PLDq0IUpYONvTVIah8Ji48ZmAei5rSgPYJ).
4 |
5 | ## Installation
6 |
7 | ```bash
8 | git clone https://github.comcodingwithdidem/twitter-clone-app.git
9 | cd twitter-clone-app
10 | npm install
11 | npm start
12 | ```
13 |
14 | **You need to create your own firestore database. Simply change `firebase.js` file with your own firebase config data.**
15 |
16 | ## Tech
17 |
18 | - ReactJS
19 | - Tailwindcss
20 | - Firebase Firestore
21 |
--------------------------------------------------------------------------------
/craco.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | style: {
3 | postcss: {
4 | plugins: [require("tailwindcss"), require("autoprefixer")],
5 | },
6 | },
7 | };
8 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "twitter-clone",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@craco/craco": "^6.1.2",
7 | "@testing-library/jest-dom": "^5.12.0",
8 | "@testing-library/react": "^11.2.6",
9 | "@testing-library/user-event": "^12.8.3",
10 | "firebase": "^8.4.3",
11 | "react": "^17.0.2",
12 | "react-dom": "^17.0.2",
13 | "react-scripts": "4.0.3",
14 | "react-twitter-widgets": "^1.10.0",
15 | "web-vitals": "^1.1.1"
16 | },
17 | "scripts": {
18 | "start": "craco start",
19 | "build": "craco build",
20 | "test": "craco test",
21 | "eject": "react-scripts eject"
22 | },
23 | "eslintConfig": {
24 | "extends": [
25 | "react-app",
26 | "react-app/jest"
27 | ]
28 | },
29 | "browserslist": {
30 | "production": [
31 | ">0.2%",
32 | "not dead",
33 | "not op_mini all"
34 | ],
35 | "development": [
36 | "last 1 chrome version",
37 | "last 1 firefox version",
38 | "last 1 safari version"
39 | ]
40 | },
41 | "devDependencies": {
42 | "autoprefixer": "^9.8.6",
43 | "postcss": "^7.0.35",
44 | "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.1.2"
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingwithdidem/twitter-clone-app/29ee2f241c5330b7da79345332d1493288a72f8c/public/favicon.ico
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
17 |
18 |
27 | React App
28 |
29 |
30 |
31 |
32 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingwithdidem/twitter-clone-app/29ee2f241c5330b7da79345332d1493288a72f8c/public/logo192.png
--------------------------------------------------------------------------------
/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingwithdidem/twitter-clone-app/29ee2f241c5330b7da79345332d1493288a72f8c/public/logo512.png
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/src/App.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import Container from "./layout/Container";
3 | import Sidebar from "./layout/Sidebar";
4 | import Content from "./layout/Content";
5 | import Widgets from "./layout/Widgets";
6 |
7 | const App = () => {
8 | return (
9 |
10 |
11 |
12 |
13 |
14 | );
15 | };
16 |
17 | export default App;
18 |
--------------------------------------------------------------------------------
/src/components/Divider.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | const Divider = () => {
4 | return (
5 |
6 | );
7 | };
8 |
9 | export default Divider;
10 |
--------------------------------------------------------------------------------
/src/components/FeedItem.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { LikeIcon, ReplyIcon, ReTweetIcon, ShareIcon } from "../icons/Icon";
3 |
4 | const FeedItem = ({
5 | avatar,
6 | content,
7 | displayName,
8 | image,
9 | timestamp,
10 | username,
11 | }) => {
12 | return (
13 |
14 |
15 |
16 |
17 |
{displayName}
18 |
{username}
19 |
20 |
21 | {timestamp?.toDate().toLocaleTimeString("tr-TR")}
22 |
23 |
24 |
{content}
25 | {image &&

}
26 |
27 | -
28 |
29 |
30 |
31 | 7
32 |
33 |
34 | -
35 |
36 |
37 |
38 | 7
39 |
40 |
41 | -
42 |
43 |
44 |
45 | 7
46 |
47 |
48 | -
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 | );
57 | };
58 |
59 | export default FeedItem;
60 |
--------------------------------------------------------------------------------
/src/components/FeedList.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import FeedItem from "./FeedItem";
3 |
4 | const FeedList = ({ tweets }) => {
5 | return (
6 |
7 | {tweets.map((tweet, index) => (
8 |
9 | ))}
10 |
11 | );
12 | };
13 |
14 | export default FeedList;
15 |
--------------------------------------------------------------------------------
/src/components/SideLink.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | const SideLink = ({ name, Icon, active, onMenuItemClick }) => {
4 | const isActive = active === name;
5 | return (
6 | onMenuItemClick(name)}>
7 |
11 |
12 |
18 |
19 | {name}
20 |
21 |
22 |
23 |
24 | );
25 | };
26 |
27 | export default SideLink;
28 |
--------------------------------------------------------------------------------
/src/components/TweetBox.js:
--------------------------------------------------------------------------------
1 | import firebase from "firebase";
2 | import React, { useState } from "react";
3 | import db from "../firebase";
4 | import {
5 | EmojiIcon,
6 | GIFIcon,
7 | ImageIcon,
8 | PollIcon,
9 | ScheduleIcon,
10 | } from "../icons/Icon";
11 |
12 | const TweetBox = () => {
13 | const [content, setContent] = useState("");
14 |
15 | const sendTweet = () => {
16 | if (content !== "") {
17 | db.collection("feed").add({
18 | displayName: "Didem Küçükkaraaslan",
19 | username: "@DidemKkkaraasl1",
20 | content,
21 | timestamp: firebase.firestore.FieldValue.serverTimestamp(),
22 | image:
23 | "https://64.media.tumblr.com/c9f8bdfb7ae61c3eb8a00e6ac5ca11a4/07dd3f9d137818fd-4f/s540x810/d83025e503bc5955cb004606132a99794b0cfab5.gif",
24 | avatar:
25 | "https://pbs.twimg.com/profile_images/1373343596150132738/j8K08iHu_400x400.jpg",
26 | });
27 |
28 | setContent("");
29 | }
30 | };
31 |
32 | return (
33 |
66 | );
67 | };
68 |
69 | export default TweetBox;
70 |
--------------------------------------------------------------------------------
/src/components/UserBox.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | const UserBox = () => {
4 | return (
5 |
6 |

11 |
12 | Didem Küçükkara...
13 | @DidemKkkaraasl1
14 |
15 |
16 |
21 |
22 | );
23 | };
24 |
25 | export default UserBox;
26 |
--------------------------------------------------------------------------------
/src/firebase.js:
--------------------------------------------------------------------------------
1 | import firebase from "firebase";
2 | import "firebase/database";
3 |
4 | const firebaseConfig = {
5 | apiKey: "AIzaSyAxCe0JRYadCqUVaE-gTHfNzw0MqIoWslU",
6 | authDomain: "twitter-clone-yt.firebaseapp.com",
7 | projectId: "twitter-clone-yt",
8 | storageBucket: "twitter-clone-yt.appspot.com",
9 | messagingSenderId: "1063511637911",
10 | appId: "1:1063511637911:web:a74c2f620b109202300ed2",
11 | measurementId: "G-9240697G9B",
12 | };
13 |
14 | // Initialize Firebase
15 | firebase.initializeApp(firebaseConfig);
16 | firebase.analytics();
17 |
18 | const db = firebase.firestore();
19 |
20 | export default db;
21 |
--------------------------------------------------------------------------------
/src/icons/Icon.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | const Svg = ({ children, className }) => {
4 | return (
5 |
8 | );
9 | };
10 |
11 | export const HomeIcon = () => {
12 | return (
13 |
18 | );
19 | };
20 |
21 | export const ExploreIcon = () => {
22 | return (
23 |
28 | );
29 | };
30 |
31 | export const NotificationsIcon = () => {
32 | return (
33 |
38 | );
39 | };
40 |
41 | export const MessagesIcon = () => {
42 | return (
43 |
48 | );
49 | };
50 |
51 | export const BookmarksIcon = () => {
52 | return (
53 |
58 | );
59 | };
60 |
61 | export const ListsIcon = () => {
62 | return (
63 |
69 | );
70 | };
71 |
72 | export const ProfileIcon = () => {
73 | return (
74 |
79 | );
80 | };
81 |
82 | export const MoreIcon = () => {
83 | return (
84 |
92 | );
93 | };
94 |
95 | // Header Icons
96 |
97 | export const PopulerIcon = ({ className }) => {
98 | return (
99 |
104 | );
105 | };
106 |
107 | export const ImageIcon = ({ className }) => {
108 | return (
109 |
115 | );
116 | };
117 | export const GIFIcon = ({ className }) => {
118 | return (
119 |
125 | );
126 | };
127 |
128 | export const PollIcon = ({ className }) => {
129 | return (
130 |
135 | );
136 | };
137 |
138 | export const EmojiIcon = ({ className }) => {
139 | return (
140 |
148 | );
149 | };
150 |
151 | export const ScheduleIcon = ({ className }) => {
152 | return (
153 |
162 | );
163 | };
164 |
165 | export const ReplyIcon = ({ className }) => {
166 | return (
167 |
172 | );
173 | };
174 |
175 | export const ReTweetIcon = ({ className }) => {
176 | return (
177 |
182 | );
183 | };
184 |
185 | export const LikeIcon = ({ className }) => {
186 | return (
187 |
192 | );
193 | };
194 |
195 | export const ShareIcon = ({ className }) => {
196 | return (
197 |
203 | );
204 | };
205 |
206 | // Widget Icons
207 |
208 | export const SearchIcon = ({ className }) => {
209 | return (
210 |
215 | );
216 | };
217 |
--------------------------------------------------------------------------------
/src/images/twitter.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/index.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
4 |
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './index.css';
4 | import App from './App';
5 | import reportWebVitals from './reportWebVitals';
6 |
7 | ReactDOM.render(
8 |
9 |
10 | ,
11 | document.getElementById('root')
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 |
--------------------------------------------------------------------------------
/src/layout/Container.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | const Container = ({ children }) => {
4 | return {children}
;
5 | };
6 |
7 | export default Container;
8 |
--------------------------------------------------------------------------------
/src/layout/Content.js:
--------------------------------------------------------------------------------
1 | import React, { useEffect, useState } from "react";
2 | import Divider from "../components/Divider";
3 | import FeedList from "../components/FeedList";
4 | import TweetBox from "../components/TweetBox";
5 | import db from "../firebase";
6 | import { PopulerIcon } from "../icons/Icon";
7 |
8 | const Content = () => {
9 | const [tweets, setTweets] = useState([]);
10 |
11 | useEffect(() => {
12 | db.collection("feed")
13 | .orderBy("timestamp", "desc")
14 | .onSnapshot((snapshot) =>
15 | setTweets(snapshot.docs.map((doc) => doc.data()))
16 | );
17 | }, []);
18 |
19 | return (
20 |
21 |
25 |
26 |

31 |
32 |
33 |
34 |
35 | {/* Feed */}
36 |
37 |
38 | );
39 | };
40 |
41 | export default Content;
42 |
--------------------------------------------------------------------------------
/src/layout/Sidebar.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from "react";
2 | import SideLink from "../components/SideLink";
3 | import UserBox from "../components/UserBox";
4 | import {
5 | BookmarksIcon,
6 | ExploreIcon,
7 | HomeIcon,
8 | ListsIcon,
9 | MessagesIcon,
10 | MoreIcon,
11 | NotificationsIcon,
12 | ProfileIcon,
13 | } from "../icons/Icon";
14 | import twitterLogo from "../images/twitter.svg";
15 |
16 | const sideLinks = [
17 | {
18 | name: "Home",
19 | icon: HomeIcon,
20 | },
21 | {
22 | name: "Explore",
23 | icon: ExploreIcon,
24 | },
25 | {
26 | name: "Notifications",
27 | icon: NotificationsIcon,
28 | },
29 | {
30 | name: "Messages",
31 | icon: MessagesIcon,
32 | },
33 | {
34 | name: "Bookmarks",
35 | icon: BookmarksIcon,
36 | },
37 | {
38 | name: "Lists",
39 | icon: ListsIcon,
40 | },
41 | {
42 | name: "Profile",
43 | icon: ProfileIcon,
44 | },
45 | {
46 | name: "More",
47 | icon: MoreIcon,
48 | },
49 | ];
50 |
51 | const Sidebar = () => {
52 | const [active, setActive] = useState("Home");
53 |
54 | const handleMenuItemClick = (name) => {
55 | setActive(name);
56 | };
57 |
58 | return (
59 |
60 |
61 |
62 |

63 |
64 |
77 |
80 |
81 |
82 |
83 | );
84 | };
85 |
86 | export default Sidebar;
87 |
--------------------------------------------------------------------------------
/src/layout/Widgets.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { Timeline } from "react-twitter-widgets";
3 | import { SearchIcon } from "../icons/Icon";
4 |
5 | const Widgets = () => {
6 | return (
7 |
28 | );
29 | };
30 |
31 | export default Widgets;
32 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/tailwind.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | purge: ["./src/**/*.{js,jsx,ts,tsx}", "./public/index.html"],
3 | darkMode: false, // or 'media' or 'class'
4 | theme: {
5 | extend: {
6 | colors: {
7 | primary: {
8 | base: "hsl(203, 89%, 53%)",
9 | dark: "hsl(203, 89%, 46%)",
10 | light: "hsl(203, 89%, 96%)",
11 | },
12 | gray: {
13 | dark: "#657786",
14 | light: "#AAB8C2",
15 | extraLight: "#E1E8ED",
16 | lightest: "#F5F8FA",
17 | },
18 | black: "#14171A",
19 | },
20 | },
21 | },
22 | variants: {
23 | extend: {},
24 | },
25 | plugins: [],
26 | };
27 |
--------------------------------------------------------------------------------