├── .firebase └── hosting.YnVpbGQ.cache ├── .firebaserc ├── .gitignore ├── README.md ├── firebase.json ├── package-lock.json ├── package.json ├── public ├── favicon.ico ├── images │ ├── Fakebook_Logo.png │ ├── fakebook_readme.jpg │ └── logo.png ├── index.html ├── manifest.json └── robots.txt └── src ├── App.js ├── App.sass ├── StateProvider.js ├── components ├── addStory │ ├── AddStory.js │ └── AddStory.sass ├── birthdays │ ├── Birthdays.js │ └── Birthdays.sass ├── chatContacts │ ├── ChatContacs.js │ └── ChatContacts.sass ├── contact │ ├── Contact.js │ └── Contact.sass ├── feed │ ├── Feed.js │ └── Feed.sass ├── header │ ├── Header.js │ └── Header.sass ├── leftSidebar │ ├── LeftSidebar.js │ └── LeftSidebar.sass ├── login │ ├── Login.js │ └── Login.sass ├── post │ ├── Post.js │ └── Post.sass ├── postCreator │ ├── PostCreator.js │ └── PostCreator.sass ├── rightSidebar │ ├── RightSidebar.js │ └── RightSidebar.sass ├── sidebarRow │ ├── SidebarRow.js │ └── SidebarRow.sass ├── story │ ├── Story.js │ └── Story.sass └── storyReel │ ├── StoryReel.js │ └── StoryReel.sass ├── firebase.js ├── index.js ├── index.sass ├── reducer.js ├── sass └── mixin.sass └── serviceWorker.js /.firebase/hosting.YnVpbGQ.cache: -------------------------------------------------------------------------------- 1 | favicon.ico,499162500000,a08fa4488c3ecef62d9effd03b3a989929bdcbecf5e905941f9034a15bd3dba3 2 | robots.txt,499162500000,391d14b3c2f8c9143a27a28c7399585142228d4d1bdbe2c87ac946de411fa9a2 3 | images/Fakebook_Logo.png,1599437777425,9652f8b6bde173673e3953c4d7c833f1c08b6f0d859fafe1358027a7758878a1 4 | images/logo.png,1599264236063,89f5d37e42dd4728cbfbb03f211f51eda913e173f28969eecbefe78b8d6b793d 5 | asset-manifest.json,1599519849719,35aada374135a1b993469f0ff68f944de8f164f5c24d5b983dfae52b6214828e 6 | precache-manifest.37bb5b2bb2e8434c3b14ef7cb0dc78d9.js,1599519849718,83589082cc0141ad9961c1d679e05ebaa41a906f80b7f6f87b766cd90ec87b4f 7 | index.html,1599519849718,9c892d786b566956f6c0fc5e70d11bfbb5e6c1539a444adb903a3e8cb75b3bde 8 | service-worker.js,1599519849718,efcab1b16bdc3416587f1ba28af195714c8d813d4e922ad9007b8976ea6d875e 9 | static/css/main.f8dd0b49.chunk.css,1599519849719,6197fa07c412fa8f96f16dba0c4a0e1fcc1be6d3f07711a1726bb0244a54c823 10 | static/js/2.cc0e0b36.chunk.js.LICENSE.txt,1599519849737,08ab60bed8cd490b3869df351addc1da53b222e47a66b05f6222f028898f5418 11 | static/js/main.f80bdb61.chunk.js,1599519849738,14c574497612d8ab03559d80921c11c1b6be42597c19827b609da34736c1eb4f 12 | static/css/main.f8dd0b49.chunk.css.map,1599519849740,80ec37c8767eb346c962f68484847f02274251c0233f38f08a38423e75fa0439 13 | static/js/runtime-main.93361c95.js,1599519849737,e070bbd48e36fc4865f8554e693d45b29a744f7c5e65a96db663bb89b7593ac0 14 | static/js/runtime-main.93361c95.js.map,1599519849738,3ab5150a22bf373b70aef38f3f1cf30153d3b4f5d626b87f86931467de548b9d 15 | manifest.json,1599516397154,326c0b234a139a123bbdf92c41996519b0125905970c848a9f6f4c80282f92a3 16 | static/js/main.f80bdb61.chunk.js.map,1599519849738,6c28493e788fe86297282cd34276366bce88a818683537cdc40aa06fb062816c 17 | static/js/2.cc0e0b36.chunk.js,1599519849739,628b71817b844a413f5dbecda3cdf6767b72738e7e3ed99d20864b96e3d6e2b4 18 | static/js/2.cc0e0b36.chunk.js.map,1599519849738,ad483b7a1d447f1114e756b7889764710866d128ab8bab061c976d4b89f3bc04 19 | -------------------------------------------------------------------------------- /.firebaserc: -------------------------------------------------------------------------------- 1 | { 2 | "projects": { 3 | "default": "fakebook-8b087" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /.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 | ![Image of Fakebook Project](https://cdn.jsdelivr.net/gh/Th3Wall/assets-cdn/Fakebook/Fakebook_readme.png) 2 | 3 | # Fakebook 4 | > This is a Facebook-clone project created with the purpose of learning the fundamentals of React.js starting from a simple Create React App. 5 | 6 | ## 🎯 About ## 7 | 8 | I've started this project with the idea of practice the fundamentals of React.js starting from a really simple [Create React App](https://github.com/facebook/create-react-app). 9 | I have re-built the brand new Facebook web interface structuring the project in small React components. 10 | The build has a built-in Google Authentication, so you require a Google account in order to be able to sign in and see the complete dashboard. 11 | 12 | ## ▶️ Demo ## 13 | 14 | Here's the [demo link](https://fakebook-8b087.web.app/). 15 | 16 | ## :sparkles: Features ## 17 | 18 | :heavy_check_mark:  Google Authentication
19 | :heavy_check_mark:  Cloud Firestore DB (Google Firebase)
20 | :heavy_check_mark:  Show Facebook cloned web-dashboard
21 | :heavy_check_mark:  Responsive site 22 | 23 | ## :rocket: Technologies ## 24 | 25 | - [React](https://reactjs.org/) 26 | - [React Context API](https://reactjs.org/docs/context.html) 27 | - [Material UI](https://material-ui.com/) 28 | - [Firebase Tools](https://firebase.google.com/) 29 | - [Sass](https://sass-lang.com/) 30 | 31 | ## :white_check_mark: Requirements ## 32 | 33 | Before starting :checkered_flag:, you need to have [Git](https://git-scm.com) and [Node](https://nodejs.org/en/) installed. 34 | -------------------------------------------------------------------------------- /firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "hosting": { 3 | "public": "build", 4 | "ignore": [ 5 | "firebase.json", 6 | "**/.*", 7 | "**/node_modules/**" 8 | ], 9 | "rewrites": [ 10 | { 11 | "source": "**", 12 | "destination": "/index.html" 13 | } 14 | ] 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fakebook", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@material-ui/core": "^4.11.0", 7 | "@material-ui/icons": "^4.9.1", 8 | "@testing-library/jest-dom": "^4.2.4", 9 | "@testing-library/react": "^9.5.0", 10 | "@testing-library/user-event": "^7.2.1", 11 | "firebase": "^7.19.1", 12 | "firebase-tools": "^8.10.0", 13 | "node-sass": "^4.14.1", 14 | "react": "^16.13.1", 15 | "react-dom": "^16.13.1", 16 | "react-scripts": "3.4.3" 17 | }, 18 | "scripts": { 19 | "start": "react-scripts start", 20 | "build": "react-scripts build", 21 | "test": "react-scripts test", 22 | "eject": "react-scripts eject" 23 | }, 24 | "eslintConfig": { 25 | "extends": "react-app" 26 | }, 27 | "browserslist": { 28 | "production": [ 29 | ">0.2%", 30 | "not dead", 31 | "not op_mini all" 32 | ], 33 | "development": [ 34 | "last 1 chrome version", 35 | "last 1 firefox version", 36 | "last 1 safari version" 37 | ] 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Th3Wall/Fakebook/0d89ba1f03de3944b7614635dc4c23748291902b/public/favicon.ico -------------------------------------------------------------------------------- /public/images/Fakebook_Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Th3Wall/Fakebook/0d89ba1f03de3944b7614635dc4c23748291902b/public/images/Fakebook_Logo.png -------------------------------------------------------------------------------- /public/images/fakebook_readme.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Th3Wall/Fakebook/0d89ba1f03de3944b7614635dc4c23748291902b/public/images/fakebook_readme.jpg -------------------------------------------------------------------------------- /public/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Th3Wall/Fakebook/0d89ba1f03de3944b7614635dc4c23748291902b/public/images/logo.png -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | Fakebook 16 | 17 | 18 | 19 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /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": "/images/logo.png", 12 | "type": "image/png", 13 | "sizes": "1024x1024" 14 | } 15 | ], 16 | "start_url": ".", 17 | "display": "standalone", 18 | "theme_color": "#000000", 19 | "background_color": "#ffffff" 20 | } 21 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /src/App.js: -------------------------------------------------------------------------------- 1 | import React, { Fragment } from 'react'; 2 | import './App.sass'; 3 | import Header from './components/header/Header'; 4 | import LeftSidebar from './components/leftSidebar/LeftSidebar'; 5 | import Feed from './components/feed/Feed'; 6 | import RightSidebar from './components/rightSidebar/RightSidebar'; 7 | import Login from './components/login/Login'; 8 | import { useStateValue } from './StateProvider' 9 | 10 | function App() { 11 | const [{user}] = useStateValue(); 12 | 13 | return ( 14 |
15 | {!user ? : 16 | 17 |
18 |
19 | 20 | 21 | 22 |
23 | 24 | } 25 |
26 | ); 27 | } 28 | 29 | export default App; -------------------------------------------------------------------------------- /src/App.sass: -------------------------------------------------------------------------------- 1 | .app 2 | background-color: #EFF2F5 3 | 4 | &__body 5 | display: flex 6 | justify-content: center -------------------------------------------------------------------------------- /src/StateProvider.js: -------------------------------------------------------------------------------- 1 | import React, { createContext, useContext, useReducer } from 'react' 2 | 3 | export const StateContext = createContext(); 4 | 5 | export const StateProvider = ({ reducer, initialState, children }) => ( 6 | 7 | {children} 8 | 9 | ); 10 | 11 | export const useStateValue = () => useContext(StateContext); -------------------------------------------------------------------------------- /src/components/addStory/AddStory.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import './AddStory.sass' 3 | import AddCircleIcon from '@material-ui/icons/AddCircle'; 4 | 5 | function AddStory({ userAvatar }) { 6 | return ( 7 |
8 |
9 |
10 |

Create a story

11 |
12 | 13 |
14 |
15 |
16 | ) 17 | } 18 | 19 | export default AddStory 20 | -------------------------------------------------------------------------------- /src/components/addStory/AddStory.sass: -------------------------------------------------------------------------------- 1 | @import '../../sass/mixin.sass' 2 | 3 | .addstory 4 | position: relative 5 | width: 110px 6 | height: 200px 7 | box-shadow: 0 5px 17px -7px rgba(0,0,0,0.75) 8 | border-radius: 10px 9 | margin-right: 10px 10 | transition: transform 0.2s ease-in-out 11 | cursor: pointer 12 | 13 | &:hover 14 | transform: scale(1.07) 15 | 16 | &__avatar 17 | background-position: center center 18 | background-size: cover 19 | background-repeat: no-repeat 20 | height: 65% 21 | width: 100% 22 | border-top-left-radius: 12px 23 | border-top-right-radius: 12px 24 | 25 | &__copywrp 26 | position: relative 27 | display: flex 28 | flex-direction: column 29 | align-items: center 30 | padding: 18px 10px 5px 10px 31 | 32 | &--text 33 | text-align: center 34 | font-size: 15px 35 | font-weight: 600 36 | 37 | &--icon 38 | position: absolute 39 | top: 50% 40 | transform: translateY(-120%) 41 | 42 | .MuiSvgIcon-root 43 | width: 1.8em 44 | height: 1.8em 45 | fill: #1769DA 46 | background: #eff2f5 47 | border-radius: 50% 48 | -------------------------------------------------------------------------------- /src/components/birthdays/Birthdays.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import './Birthdays.sass' 3 | import SidebarRow from '../sidebarRow/SidebarRow' 4 | import CakeIcon from '@material-ui/icons/Cake'; 5 | 6 | function Birthdays() { 7 | return ( 8 |
9 |

Birthdays

10 | 11 |
12 | ) 13 | } 14 | 15 | export default Birthdays 16 | -------------------------------------------------------------------------------- /src/components/birthdays/Birthdays.sass: -------------------------------------------------------------------------------- 1 | @import '../../sass/mixin.sass' 2 | 3 | .birthdays 4 | padding-bottom: 20px 5 | border-bottom: 1px solid #cccccc 6 | 7 | &__header 8 | font-size: 16px 9 | color: #65676b 10 | font-weight: 600 11 | margin-left: 10px 12 | 13 | .sidebar__row 14 | margin-top: 10px 15 | 16 | .MuiSvgIcon-root 17 | margin-right: 10px 18 | 19 | span 20 | font-size: 15px 21 | font-weight: 400 -------------------------------------------------------------------------------- /src/components/chatContacts/ChatContacs.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import './ChatContacts.sass' 3 | import VideoCallIcon from '@material-ui/icons/VideoCall'; 4 | import SearchIcon from '@material-ui/icons/Search'; 5 | import MoreHorizIcon from '@material-ui/icons/MoreHoriz'; 6 | import Contact from '../contact/Contact'; 7 | 8 | function ChatContacs() { 9 | return ( 10 |
11 |
12 |

Contacts

13 |
14 | 15 | 16 | 17 |
18 |
19 | {/* */} 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 |
35 | ) 36 | } 37 | 38 | export default ChatContacs 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/components/chatContacts/ChatContacts.sass: -------------------------------------------------------------------------------- 1 | @import '../../sass/mixin.sass' 2 | 3 | .contacts 4 | padding-top: 20px 5 | 6 | &__header 7 | display: flex 8 | justify-content: space-between 9 | align-items: center 10 | font-size: 16px 11 | color: #65676b 12 | font-weight: 600 13 | margin-left: 10px 14 | margin-bottom: 15px 15 | 16 | .MuiSvgIcon-root 17 | margin: 0 5px -------------------------------------------------------------------------------- /src/components/contact/Contact.js: -------------------------------------------------------------------------------- 1 | import React, { Fragment } from 'react' 2 | import './Contact.sass' 3 | import { Avatar } from '@material-ui/core'; 4 | 5 | function Contact({ contactAvatar, contactName }) { 6 | return ( 7 | 8 | {contactName && contactAvatar && 9 | ( 10 |
11 |
12 | 13 |
14 |
15 |

{contactName}

16 |
17 | ) 18 | } 19 |
20 | ) 21 | } 22 | 23 | export default Contact 24 | -------------------------------------------------------------------------------- /src/components/contact/Contact.sass: -------------------------------------------------------------------------------- 1 | @import '../../sass/mixin.sass' 2 | 3 | .contact 4 | display: flex 5 | align-items: center 6 | cursor: pointer 7 | padding: 10px 8 | border-radius: 10px 9 | 10 | &:hover 11 | background-color: #e4e6e9 12 | 13 | h4 14 | font-size: 15px 15 | margin-left: 15px 16 | font-weight: 600 17 | 18 | .MuiAvatar-img 19 | width: 32px 20 | height: 32px 21 | border-radius: 50% 22 | 23 | &__avatar 24 | height: 32px 25 | 26 | 27 | .avatar 28 | &__wrp 29 | position: relative 30 | 31 | .online 32 | position: absolute 33 | bottom: 0 34 | right: 0 35 | background-color: green 36 | border: 2px solid #eff2f5 37 | width: 8px 38 | height: 8px 39 | border-radius: 50% -------------------------------------------------------------------------------- /src/components/feed/Feed.js: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from 'react' 2 | import './Feed.sass' 3 | import StoryReel from '../storyReel/StoryReel' 4 | import PostCreator from '../postCreator/PostCreator' 5 | import Post from '../post/Post' 6 | import db from '../../firebase' 7 | 8 | function Feed() { 9 | 10 | const [posts, setPosts] = useState([]); 11 | 12 | useEffect(() => { 13 | db.collection('posts').orderBy('timestamp', 'desc').onSnapshot(snapshot => setPosts(snapshot.docs.map(doc => ({id: doc.id, data: doc.data()})))) 14 | }, []); 15 | 16 | return ( 17 |
18 | 19 | 20 | 21 | {posts.map((post) => ( 22 | 30 | ))} 31 |
32 | ) 33 | } 34 | 35 | export default Feed 36 | -------------------------------------------------------------------------------- /src/components/feed/Feed.sass: -------------------------------------------------------------------------------- 1 | @import '../../sass/mixin.sass' 2 | 3 | .feed 4 | display: flex 5 | flex-direction: column 6 | flex: 1 7 | align-items: center 8 | justify-content: center 9 | padding: 30px 20px 10 | width: calc(100% - 60px) 11 | @include mq(1100px) 12 | padding: 30px 40px 13 | max-width: 700px 14 | @include mq(ll) 15 | padding: 30px 150px 16 | max-width: 750px -------------------------------------------------------------------------------- /src/components/header/Header.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import SearchIcon from '@material-ui/icons/Search'; 3 | import HomeIcon from '@material-ui/icons/Home'; 4 | import FlagIcon from '@material-ui/icons/Flag'; 5 | import SubscriptionsOutlinedIcon from '@material-ui/icons/SubscriptionsOutlined'; 6 | import StorefrontOutlinedIcon from '@material-ui/icons/StorefrontOutlined'; 7 | import SupervisedUserCircleRoundedIcon from '@material-ui/icons/SupervisedUserCircleRounded'; 8 | import AddIcon from '@material-ui/icons/Add'; 9 | import ForumIcon from '@material-ui/icons/Forum'; 10 | import NotificationsActiveIcon from '@material-ui/icons/NotificationsActive'; 11 | import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; 12 | import { Avatar, IconButton } from '@material-ui/core'; 13 | import './Header.sass'; 14 | import { useStateValue } from '../../StateProvider' 15 | 16 | function Header() { 17 | 18 | const [{ user }] = useStateValue(); 19 | 20 | return ( 21 | 71 | ) 72 | } 73 | 74 | export default Header 75 | -------------------------------------------------------------------------------- /src/components/header/Header.sass: -------------------------------------------------------------------------------- 1 | @import '../../sass/mixin.sass' 2 | 3 | .header 4 | position: sticky 5 | z-index: 100 6 | top: 0 7 | display: flex 8 | justify-content: space-between 9 | padding: 8px 20px 10 | background-color: #ffffff 11 | box-shadow: 0 5px 8px -9px rgba(0,0,0,.75) 12 | @include mq(701px) 13 | padding: 0 20px 14 | 15 | &__left 16 | display: flex 17 | align-items: center 18 | justify-content: space-evenly 19 | 20 | &--input 21 | display: none 22 | @include mq(lg) 23 | display: flex 24 | align-items: center 25 | background-color: #eff2f5 26 | margin-left: 10px 27 | padding: 10px 28 | border-radius: 999px 29 | min-width: 215px 30 | 31 | .searchinput 32 | border: none 33 | outline-width: 0 34 | background-color: transparent 35 | margin-left: 5px 36 | font-size: 14px 37 | width: 100% 38 | 39 | .MuiSvgIcon-root 40 | fill: gray 41 | 42 | .logo 43 | height: 40px 44 | 45 | .searchinput 46 | &__mob 47 | display: flex 48 | margin-left: 6px 49 | padding: 10px 50 | background-color: #eff2f5 51 | @include mq(lg) 52 | display: none 53 | 54 | &__middle 55 | display: flex 56 | flex: 1 57 | justify-content: flex-end 58 | @include mq(lg) 59 | justify-content: center 60 | 61 | &--option 62 | display: none 63 | @include mq(701px) 64 | display: flex 65 | align-items: center 66 | justify-content: center 67 | height: 60px 68 | cursor: pointer 69 | margin-left: 8px 70 | min-width: 50px 71 | @include mq(lg) 72 | min-width: 110px 73 | 74 | .MuiSvgIcon-root 75 | color: gray 76 | 77 | &:first-child 78 | margin-left: 0 79 | 80 | &:hover 81 | align-items: center 82 | border-radius: 10px 83 | border-bottom: none 84 | background-color: #eff2f5 85 | 86 | .MuiSvgIcon-root 87 | color: #2e81f4 88 | 89 | &-active 90 | border-bottom: 3px solid #2e81f4 91 | 92 | .MuiSvgIcon-root 93 | color: #2e81f4 94 | 95 | &:hover 96 | border-bottom: 3px solid #2e81f4 97 | border-radius: 0 98 | background-color: transparent 99 | 100 | &__right 101 | display: flex 102 | align-items: center 103 | 104 | &--info 105 | display: none 106 | @include mq(ll) 107 | display: flex 108 | align-items: center 109 | 110 | .displayname 111 | margin-left: 10px 112 | margin-right: 10px 113 | 114 | .MuiAvatar-root 115 | width: 30px 116 | height: 30px 117 | 118 | .MuiIconButton-root 119 | height: 40px 120 | padding: 8px 121 | background-color: #E3E6EA 122 | margin: 0 3px 123 | 124 | .MuiSvgIcon-root 125 | color: black -------------------------------------------------------------------------------- /src/components/leftSidebar/LeftSidebar.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import './LeftSidebar.sass' 3 | import SidebarRow from '../sidebarRow/SidebarRow' 4 | import LocalHospitalIcon from '@material-ui/icons/LocalHospital'; 5 | import EmojiFlagsIcon from '@material-ui/icons/EmojiFlags'; 6 | import PeopleIcon from '@material-ui/icons/People'; 7 | import ChatIcon from '@material-ui/icons/Chat'; 8 | import StorefrontIcon from '@material-ui/icons/Storefront'; 9 | import VideoLibraryIcon from '@material-ui/icons/VideoLibrary'; 10 | import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; 11 | import { useStateValue } from '../../StateProvider'; 12 | 13 | function LeftSidebar (){ 14 | 15 | const [{user}] = useStateValue(); 16 | 17 | return ( 18 |
19 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | ) 30 | } 31 | 32 | export default LeftSidebar; -------------------------------------------------------------------------------- /src/components/leftSidebar/LeftSidebar.sass: -------------------------------------------------------------------------------- 1 | @import '../../sass/mixin.sass' 2 | 3 | .sidebar 4 | &__left 5 | display: none 6 | @include mq(1100px) 7 | display: block 8 | flex: 0.33 9 | padding: 25px 10px -------------------------------------------------------------------------------- /src/components/login/Login.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import './Login.sass' 3 | import { Button } from '@material-ui/core' 4 | import { auth, provider } from '../../firebase' 5 | import { actionTypes } from '../../reducer.js' 6 | import { useStateValue } from '../../StateProvider.js' 7 | 8 | function Login() { 9 | 10 | const [state, dispatch] = useStateValue(); 11 | 12 | const signIn = () => { 13 | auth 14 | .signInWithPopup(provider) 15 | .then(result => { 16 | dispatch({ 17 | type: actionTypes.SET_USER, 18 | user: result.user 19 | }) 20 | }) 21 | .catch((error) => alert(error.message)) 22 | } 23 | 24 | return ( 25 |
26 |
27 | 28 | 29 |
30 | 33 |
34 | ) 35 | } 36 | 37 | export default Login 38 | -------------------------------------------------------------------------------- /src/components/login/Login.sass: -------------------------------------------------------------------------------- 1 | @import '../../sass/mixin.sass' 2 | 3 | .login 4 | display: flex 5 | flex-direction: column 6 | align-items: center 7 | justify-content: center 8 | height: 100vh 9 | 10 | &__logo 11 | display: flex 12 | flex-direction: column 13 | margin-bottom: 5em 14 | 15 | img 16 | max-height: 150px 17 | object-fit: contain 18 | 19 | &__button 20 | max-width: 300px 21 | width: 100% 22 | background-color: #2e81f4 !important 23 | color: #eff2f5 !important 24 | font-weight: 800 !important -------------------------------------------------------------------------------- /src/components/post/Post.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { Avatar } from '@material-ui/core' 3 | import ThumbUpIcon from '@material-ui/icons/ThumbUp'; 4 | import ChatBubbleOutlinedIcon from '@material-ui/icons/ChatBubbleOutlined'; 5 | import NearMeIcon from '@material-ui/icons/NearMe'; 6 | import AccountCircleIcon from '@material-ui/icons/AccountCircle'; 7 | import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; 8 | import './Post.sass' 9 | 10 | function Post({ authorPic, authorName, timestamp, message, optionalImg }) { 11 | return ( 12 |
13 |
14 | 15 |
16 |

{authorName}

17 |

{new Date(timestamp?.toDate()).toUTCString()}

18 |
19 |
20 |
21 |

{message}

22 |
23 |
24 | 25 |
26 |
27 |
28 | 29 |

Like

30 |
31 |
32 | 33 |

Comment

34 |
35 |
36 | 37 |

Share

38 |
39 |
40 | 41 | 42 |
43 |
44 |
45 | ) 46 | } 47 | 48 | export default Post 49 | -------------------------------------------------------------------------------- /src/components/post/Post.sass: -------------------------------------------------------------------------------- 1 | @import '../../sass/mixin.sass' 2 | 3 | .post 4 | margin-top: 15px 5 | border-radius: 15px 6 | background-color: #ffffff 7 | width: 100% 8 | box-shadow: 0 5px 7px -7px rgba(0,0,0,0.75) 9 | 10 | &__top 11 | display: flex 12 | align-items: center 13 | position: relative 14 | padding: 15px 15 | 16 | &__avatar 17 | margin-right: 10px 18 | 19 | &__info 20 | h3 21 | font-size: medium 22 | p 23 | font-size: small 24 | color: gray 25 | 26 | &__media 27 | img 28 | width: 100% 29 | 30 | &__bottom 31 | padding: 10px 25px 32 | margin-top: 10px 33 | margin-bottom: 10px 34 | 35 | &__options 36 | display: flex 37 | justify-content: space-evenly 38 | align-items: center 39 | font-size: medium 40 | padding: 5px 15px 41 | border-top: 1px solid #eff2f5 42 | cursor: pointer 43 | color: gray 44 | 45 | &--option 46 | display: flex 47 | align-items: center 48 | justify-content: center 49 | flex: 1 50 | padding: 10px 5px 51 | border-radius: 10px 52 | 53 | &:hover 54 | background-color: #eff2f5 55 | 56 | p 57 | margin-left: 10px 58 | 59 | &.nomob 60 | display: none 61 | @include mq(md) 62 | display: flex -------------------------------------------------------------------------------- /src/components/postCreator/PostCreator.js: -------------------------------------------------------------------------------- 1 | import React, {useState} from 'react' 2 | import './PostCreator.sass' 3 | import { Avatar } from '@material-ui/core' 4 | import VideocamIcon from '@material-ui/icons/Videocam'; 5 | import PhotoLibraryIcon from '@material-ui/icons/PhotoLibrary'; 6 | import InsertEmoticonIcon from '@material-ui/icons/InsertEmoticon'; 7 | import { useStateValue } from '../../StateProvider'; 8 | import db from '../../firebase'; 9 | import firebase from 'firebase'; 10 | 11 | function PostCreator() { 12 | 13 | const [input, setInput] = useState(''); 14 | const [imageUrl, setImageUrl] = useState(''); 15 | const [{user}] = useStateValue(); 16 | 17 | const handleSubmit = (e) => { 18 | e.preventDefault(); 19 | 20 | db.collection('posts').add({ 21 | message: input, 22 | timestamp: firebase.firestore.FieldValue.serverTimestamp(), 23 | authorPic: user.photoURL, 24 | authorName: user.displayName, 25 | optionalImg: imageUrl 26 | }) 27 | 28 | setInput(''); 29 | setImageUrl(''); 30 | } 31 | 32 | return ( 33 |
34 |
35 | 36 |
37 | setInput(e.target.value)} className="postcreator__input" type="text" placeholder={`What's on your mind, ${user.displayName}?`}/> 38 | setImageUrl(e.target.value)} type="text" placeholder="Image Url (Optional)"/> 39 | 40 |
41 |
42 |
43 |
44 | 45 |

Live Video

46 |
47 |
48 | 49 |

Photo/Video

50 |
51 |
52 | 53 |

Feeling/Activity

54 |
55 |
56 |
57 | ) 58 | } 59 | 60 | export default PostCreator 61 | -------------------------------------------------------------------------------- /src/components/postCreator/PostCreator.sass: -------------------------------------------------------------------------------- 1 | @import '../../sass/mixin.sass' 2 | 3 | .postcreator 4 | display: flex 5 | flex-direction: column 6 | margin-top: 30px 7 | border-radius: 15px 8 | background-color: #ffffff 9 | width: 100% 10 | box-shadow: 0 5px 7px -7px rgba(0,0,0,0.75) 11 | 12 | &__top 13 | display: flex 14 | padding: 15px 15 | border-bottom: 1px solid #eff2f5 16 | 17 | form 18 | flex: 1 19 | display: flex 20 | 21 | input 22 | background-color: #eff2f5 23 | outline-width: 0 24 | border: none 25 | padding: 5px 20px 26 | margin: 0 10px 27 | border-radius: 999px 28 | font-size: 15px 29 | cursor: pointer 30 | transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out 31 | 32 | &:hover 33 | background-color: #e4e6e9 34 | color: #606266 35 | 36 | button 37 | display: none 38 | 39 | &__input 40 | flex: 1 41 | background-color: #eff2f5 42 | outline-width: 0 43 | border: none 44 | padding: 5px 20px 45 | margin: 0 10px 46 | border-radius: 999px 47 | font-size: 15px 48 | cursor: pointer 49 | transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out 50 | 51 | &:hover 52 | background-color: #e4e6e9 53 | color: #606266 54 | 55 | &__bottom 56 | display: flex 57 | justify-content: space-evenly 58 | 59 | &--option 60 | display: flex 61 | align-items: center 62 | color: gray 63 | margin: 5px 64 | padding: 12px 20px 65 | border-radius: 10px 66 | cursor: pointer 67 | transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out 68 | 69 | h3 70 | font-size: medium 71 | margin-left: 10px 72 | 73 | &:hover 74 | background-color: #eff2f5 75 | color: #606266 76 | 77 | &.nomob 78 | display: none 79 | @include mq(600px) 80 | display: flex -------------------------------------------------------------------------------- /src/components/rightSidebar/RightSidebar.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import './RightSidebar.sass' 3 | import Birthdays from '../birthdays/Birthdays' 4 | import ChatContacs from '../chatContacts/ChatContacs' 5 | 6 | function RightSidebar() { 7 | return ( 8 |
9 | 10 | 11 |
12 | ) 13 | } 14 | 15 | export default RightSidebar 16 | -------------------------------------------------------------------------------- /src/components/rightSidebar/RightSidebar.sass: -------------------------------------------------------------------------------- 1 | @import '../../sass/mixin.sass' 2 | 3 | .sidebar 4 | &__right 5 | display: none 6 | @include mq(900px) 7 | display: block 8 | flex: 0.33 9 | padding: 25px 10px -------------------------------------------------------------------------------- /src/components/sidebarRow/SidebarRow.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { Avatar } from '@material-ui/core'; 3 | import './SidebarRow.sass' 4 | 5 | function SidebarRow({ title, src, Icon, birthdays }) { 6 | 7 | return ( 8 |
9 | {src && } 10 | {Icon && } 11 | 12 | {title &&

{title}

} 13 | {birthdays && ( 14 | birthdays.length > 1 15 | ? {birthdays[0]} and other {birthdays.length - 1} friends have their birthdays today. 16 | : Today is {birthdays[0]}'s birthday. 17 | )} 18 |
19 | ) 20 | } 21 | 22 | export default SidebarRow 23 | -------------------------------------------------------------------------------- /src/components/sidebarRow/SidebarRow.sass: -------------------------------------------------------------------------------- 1 | @import '../../sass/mixin.sass' 2 | 3 | .sidebar 4 | &__row 5 | display: flex 6 | align-items: center 7 | cursor: pointer 8 | padding: 10px 9 | border-radius: 10px 10 | 11 | &:hover 12 | background-color: #e4e6e9 13 | 14 | h4 15 | margin-left: 20px 16 | font-weight: 600 17 | 18 | .MuiSvgIcon-root 19 | font-size: xx-large 20 | color: #2e81f4 21 | 22 | .MuiAvatar-root 23 | width: 32px 24 | height: 32px -------------------------------------------------------------------------------- /src/components/story/Story.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import './Story.sass' 3 | import { Avatar } from '@material-ui/core'; 4 | 5 | function Story({ image, authorPic, authorName }) { 6 | return ( 7 |
8 | 9 |

{authorName}

10 |
11 | ) 12 | } 13 | 14 | export default Story 15 | -------------------------------------------------------------------------------- /src/components/story/Story.sass: -------------------------------------------------------------------------------- 1 | @import '../../sass/mixin.sass' 2 | 3 | .story 4 | position: relative 5 | background-position: center center 6 | background-repeat: no-repeat 7 | background-size: cover 8 | width: 110px 9 | height: 200px 10 | box-shadow: 0 5px 17px -7px rgba(0,0,0,0.75) 11 | border-radius: 10px 12 | margin-right: 10px 13 | transition: transform 0.2s ease-in-out 14 | cursor: pointer 15 | 16 | &:hover 17 | transform: scale(1.07) 18 | 19 | &__avatar 20 | margin: 10px 21 | border: 4px solid #2e81f4 22 | 23 | h4 24 | position: absolute 25 | font-size: 15px 26 | font-weight: 600 27 | max-width: 90% 28 | bottom: 15px 29 | left: 15px 30 | color: #ffffff 31 | text-shadow: 1px 1px 7px rgba(0,0,0,0.75) -------------------------------------------------------------------------------- /src/components/storyReel/StoryReel.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import Story from '../story/Story' 3 | import './StoryReel.sass'; 4 | import AddStory from '../addStory/AddStory'; 5 | import { useStateValue } from '../../StateProvider'; 6 | 7 | function StoryReel() { 8 | const [{user}] = useStateValue(); 9 | 10 | return ( 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | ) 20 | } 21 | 22 | export default StoryReel 23 | -------------------------------------------------------------------------------- /src/components/storyReel/StoryReel.sass: -------------------------------------------------------------------------------- 1 | @import '../../sass/mixin.sass' 2 | 3 | .stories 4 | display: flex -------------------------------------------------------------------------------- /src/firebase.js: -------------------------------------------------------------------------------- 1 | import firebase from 'firebase' 2 | 3 | const firebaseConfig = { 4 | apiKey: "AIzaSyBHqi3Keinr8Ffvn0LDpcgHb_I45GEmVjw", 5 | authDomain: "fakebook-8b087.firebaseapp.com", 6 | databaseURL: "https://fakebook-8b087.firebaseio.com", 7 | projectId: "fakebook-8b087", 8 | storageBucket: "fakebook-8b087.appspot.com", 9 | messagingSenderId: "868669292938", 10 | appId: "1:868669292938:web:61d403da7404a37bcd0873", 11 | measurementId: "G-8BHY5P5SZM" 12 | }; 13 | 14 | const firebaseApp = firebase.initializeApp(firebaseConfig); 15 | const db = firebaseApp.firestore(); 16 | const auth = firebase.auth(); 17 | const provider = new firebase.auth.GoogleAuthProvider(); 18 | 19 | export { auth, provider }; 20 | export default db; -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './sass/mixin.sass'; 4 | import './index.sass'; 5 | import App from './App'; 6 | import * as serviceWorker from './serviceWorker'; 7 | import { StateProvider } from './StateProvider'; 8 | import reducer, {initialState} from './reducer' 9 | 10 | ReactDOM.render( 11 | 12 | 13 | 14 | 15 | , 16 | document.getElementById('root') 17 | ); 18 | 19 | // If you want your app to work offline and load faster, you can change 20 | // unregister() to register() below. Note this comes with some pitfalls. 21 | // Learn more about service workers: https://bit.ly/CRA-PWA 22 | serviceWorker.unregister(); 23 | -------------------------------------------------------------------------------- /src/index.sass: -------------------------------------------------------------------------------- 1 | * 2 | margin: 0 3 | 4 | body 5 | margin: 0 6 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif 7 | -webkit-font-smoothing: antialiased 8 | -moz-osx-font-smoothing: grayscale 9 | 10 | code 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace -------------------------------------------------------------------------------- /src/reducer.js: -------------------------------------------------------------------------------- 1 | export const initialState = { 2 | user: null 3 | }; 4 | 5 | export const actionTypes = { 6 | SET_USER : 'SET_USER', 7 | }; 8 | 9 | const reducer = (state, action) => { 10 | switch (action.type) { 11 | case actionTypes.SET_USER: 12 | return { 13 | ...state, 14 | user: action.user 15 | }; 16 | default : 17 | return state; 18 | } 19 | }; 20 | 21 | export default reducer; -------------------------------------------------------------------------------- /src/sass/mixin.sass: -------------------------------------------------------------------------------- 1 | /* 2 | * VARIABLES 3 | */ 4 | $breakpoints: ( ll: 1450px, lg: 1024px, md: 768px, sm: 640px ) !default 5 | /* 6 | * MIXINS 7 | */ 8 | @mixin mq($min: null, $max: null) 9 | $min-type: type-of($min) 10 | $max-type: type-of($max) 11 | 12 | @if $min-type == string 13 | @if $min == sm 14 | $min: "(min-width: #{map-get($breakpoints, sm)})" 15 | @else if $min == md 16 | $min: "(min-width: #{map-get($breakpoints, md)})" 17 | @else if $min == lg 18 | $min: "(min-width: #{map-get($breakpoints, lg)})" 19 | @else if $min == ll 20 | $min: "(min-width: #{map-get($breakpoints, ll)})" 21 | @else 22 | @warn "mq mixin supports: sm, md, lg, ll" 23 | 24 | @else if $min-type == number 25 | $min: "(min-width: #{$min})" 26 | 27 | @if $max-type == string 28 | @if $max == sm 29 | $max: "(max-width: #{map-get($breakpoints, sm) - 1})" 30 | @else if $max == md 31 | $max: "(max-width: #{map-get($breakpoints, md) - 1})" 32 | @else if $max == lg 33 | $max: "(max-width: #{map-get($breakpoints, lg) - 1})" 34 | @else if $max == ll 35 | $max: "(max-width: #{map-get($breakpoints, ll) - 1})" 36 | @else 37 | @warn "mq mixin supports: sm, md, lg, ll" 38 | @else if $max-type == number 39 | $max: "(max-width: #{$max})" 40 | 41 | $query: false 42 | @if $min and $max 43 | $query: "#{$min} and #{$max}" 44 | @else if $min 45 | $query: "#{$min}" 46 | @else if $max 47 | $query: "#{$max}" 48 | 49 | @if ( not $query ) 50 | @warn "Invalid media query" 51 | @else 52 | @media #{$query} 53 | @content 54 | 55 | @mixin mob() 56 | @include mq(null, md) 57 | @content 58 | 59 | @mixin smart() 60 | @include mq(null, sm) 61 | @content 62 | 63 | @mixin tab-portrait() 64 | @include mq(sm, md) 65 | @content 66 | 67 | @mixin tab-landscape() 68 | @include mq(md, lg) 69 | @content 70 | 71 | @mixin desk() 72 | @include mq(lg) 73 | @content 74 | /* 75 | * CSS 76 | */ 77 | 78 | body 79 | margin: 0 80 | padding: 0 -------------------------------------------------------------------------------- /src/serviceWorker.js: -------------------------------------------------------------------------------- 1 | // This optional code is used to register a service worker. 2 | // register() is not called by default. 3 | 4 | // This lets the app load faster on subsequent visits in production, and gives 5 | // it offline capabilities. However, it also means that developers (and users) 6 | // will only see deployed updates on subsequent visits to a page, after all the 7 | // existing tabs open on the page have been closed, since previously cached 8 | // resources are updated in the background. 9 | 10 | // To learn more about the benefits of this model and instructions on how to 11 | // opt-in, read https://bit.ly/CRA-PWA 12 | 13 | const isLocalhost = Boolean( 14 | window.location.hostname === 'localhost' || 15 | // [::1] is the IPv6 localhost address. 16 | window.location.hostname === '[::1]' || 17 | // 127.0.0.0/8 are considered localhost for IPv4. 18 | window.location.hostname.match( 19 | /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ 20 | ) 21 | ); 22 | 23 | export function register(config) { 24 | if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { 25 | // The URL constructor is available in all browsers that support SW. 26 | const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); 27 | if (publicUrl.origin !== window.location.origin) { 28 | // Our service worker won't work if PUBLIC_URL is on a different origin 29 | // from what our page is served on. This might happen if a CDN is used to 30 | // serve assets; see https://github.com/facebook/create-react-app/issues/2374 31 | return; 32 | } 33 | 34 | window.addEventListener('load', () => { 35 | const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; 36 | 37 | if (isLocalhost) { 38 | // This is running on localhost. Let's check if a service worker still exists or not. 39 | checkValidServiceWorker(swUrl, config); 40 | 41 | // Add some additional logging to localhost, pointing developers to the 42 | // service worker/PWA documentation. 43 | navigator.serviceWorker.ready.then(() => { 44 | console.log( 45 | 'This web app is being served cache-first by a service ' + 46 | 'worker. To learn more, visit https://bit.ly/CRA-PWA' 47 | ); 48 | }); 49 | } else { 50 | // Is not localhost. Just register service worker 51 | registerValidSW(swUrl, config); 52 | } 53 | }); 54 | } 55 | } 56 | 57 | function registerValidSW(swUrl, config) { 58 | navigator.serviceWorker 59 | .register(swUrl) 60 | .then(registration => { 61 | registration.onupdatefound = () => { 62 | const installingWorker = registration.installing; 63 | if (installingWorker == null) { 64 | return; 65 | } 66 | installingWorker.onstatechange = () => { 67 | if (installingWorker.state === 'installed') { 68 | if (navigator.serviceWorker.controller) { 69 | // At this point, the updated precached content has been fetched, 70 | // but the previous service worker will still serve the older 71 | // content until all client tabs are closed. 72 | console.log( 73 | 'New content is available and will be used when all ' + 74 | 'tabs for this page are closed. See https://bit.ly/CRA-PWA.' 75 | ); 76 | 77 | // Execute callback 78 | if (config && config.onUpdate) { 79 | config.onUpdate(registration); 80 | } 81 | } else { 82 | // At this point, everything has been precached. 83 | // It's the perfect time to display a 84 | // "Content is cached for offline use." message. 85 | console.log('Content is cached for offline use.'); 86 | 87 | // Execute callback 88 | if (config && config.onSuccess) { 89 | config.onSuccess(registration); 90 | } 91 | } 92 | } 93 | }; 94 | }; 95 | }) 96 | .catch(error => { 97 | console.error('Error during service worker registration:', error); 98 | }); 99 | } 100 | 101 | function checkValidServiceWorker(swUrl, config) { 102 | // Check if the service worker can be found. If it can't reload the page. 103 | fetch(swUrl, { 104 | headers: { 'Service-Worker': 'script' }, 105 | }) 106 | .then(response => { 107 | // Ensure service worker exists, and that we really are getting a JS file. 108 | const contentType = response.headers.get('content-type'); 109 | if ( 110 | response.status === 404 || 111 | (contentType != null && contentType.indexOf('javascript') === -1) 112 | ) { 113 | // No service worker found. Probably a different app. Reload the page. 114 | navigator.serviceWorker.ready.then(registration => { 115 | registration.unregister().then(() => { 116 | window.location.reload(); 117 | }); 118 | }); 119 | } else { 120 | // Service worker found. Proceed as normal. 121 | registerValidSW(swUrl, config); 122 | } 123 | }) 124 | .catch(() => { 125 | console.log( 126 | 'No internet connection found. App is running in offline mode.' 127 | ); 128 | }); 129 | } 130 | 131 | export function unregister() { 132 | if ('serviceWorker' in navigator) { 133 | navigator.serviceWorker.ready 134 | .then(registration => { 135 | registration.unregister(); 136 | }) 137 | .catch(error => { 138 | console.error(error.message); 139 | }); 140 | } 141 | } 142 | --------------------------------------------------------------------------------