diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4d29575 --- /dev/null +++ b/.gitignore @@ -0,0 +1,23 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# production +/build + +# misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/README.md b/README.md index 4e962c6..02aac3f 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,70 @@ -# Gmail_Clone -Created with CodeSandbox +# Getting Started with Create React App + +This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). + +## Available Scripts + +In the project directory, you can run: + +### `yarn start` + +Runs the app in the development mode.\ +Open [http://localhost:3000](http://localhost:3000) to view it in the browser. + +The page will reload if you make edits.\ +You will also see any lint errors in the console. + +### `yarn test` + +Launches the test runner in the interactive watch mode.\ +See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. + +### `yarn build` + +Builds the app for production to the `build` folder.\ +It correctly bundles React in production mode and optimizes the build for the best performance. + +The build is minified and the filenames include the hashes.\ +Your app is ready to be deployed! + +See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. + +### `yarn eject` + +**Note: this is a one-way operation. Once you `eject`, you can’t go back!** + +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. + +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. + +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. + +## Learn More + +You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). + +To learn React, check out the [React documentation](https://reactjs.org/). + +### Code Splitting + +This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) + +### Analyzing the Bundle Size + +This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) + +### Making a Progressive Web App + +This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) + +### Advanced Configuration + +This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) + +### Deployment + +This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) + +### `yarn build` fails to minify + +This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) diff --git a/package.json b/package.json new file mode 100644 index 0000000..f6400b0 --- /dev/null +++ b/package.json @@ -0,0 +1,46 @@ +{ + "name": "gmail-clone-reactjs", + "version": "0.1.0", + "private": true, + "dependencies": { + "@material-ui/core": "4.12.3", + "@material-ui/icons": "4.11.2", + "@testing-library/jest-dom": "^5.11.4", + "@testing-library/react": "^11.1.0", + "@testing-library/user-event": "^12.1.10", + "react": "^17.0.2", + "react-dom": "^17.0.2", + "react-icons": "^4.2.0", + "react-redux": "^7.2.4", + "react-router-dom": "^5.2.0", + "react-scripts": "4.0.3", + "redux": "^4.1.1", + "web-vitals": "^1.0.1" + }, + "scripts": { + "start": "react-scripts start", + "build": "react-scripts build", + "test": "react-scripts test", + "eject": "react-scripts eject" + }, + "eslintConfig": { + "extends": [ + "react-app", + "react-app/jest" + ] + }, + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + }, + "keywords": [], + "description": "" +} \ No newline at end of file diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..a11777c Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..133673c --- /dev/null +++ b/public/index.html @@ -0,0 +1,44 @@ + + + + + + + + + + + + + React App + + + + +
+ + + diff --git a/public/logo192.png b/public/logo192.png new file mode 100644 index 0000000..fc44b0a Binary files /dev/null and b/public/logo192.png differ diff --git a/public/logo512.png b/public/logo512.png new file mode 100644 index 0000000..a4e47a6 Binary files /dev/null and b/public/logo512.png differ diff --git a/public/manifest.json b/public/manifest.json new file mode 100644 index 0000000..080d6c7 --- /dev/null +++ b/public/manifest.json @@ -0,0 +1,25 @@ +{ + "short_name": "React App", + "name": "Create React App Sample", + "icons": [ + { + "src": "favicon.ico", + "sizes": "64x64 32x32 24x24 16x16", + "type": "image/x-icon" + }, + { + "src": "logo192.png", + "type": "image/png", + "sizes": "192x192" + }, + { + "src": "logo512.png", + "type": "image/png", + "sizes": "512x512" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 0000000..e9e57dc --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,3 @@ +# https://www.robotstxt.org/robotstxt.html +User-agent: * +Disallow: diff --git a/src/App.css b/src/App.css new file mode 100644 index 0000000..ece4cc1 --- /dev/null +++ b/src/App.css @@ -0,0 +1,11 @@ +* { + margin: 0; +} + +.body { + display: grid; + grid-template-columns: 296px 1fr; +} +hr { + border-top: 1px solid #f1f1f1; +} diff --git a/src/App.js b/src/App.js new file mode 100644 index 0000000..2296b62 --- /dev/null +++ b/src/App.js @@ -0,0 +1,22 @@ +import Content from "./Components/Content/Content"; +import Navbar from "./Components/Navigation/Navbar"; +import SideBar from "./Components/SideBar/SideBar"; +import { BrowserRouter as Router } from "react-router-dom"; +import "./App.css"; + +function App() { + return ( + +
+ +
+
+ + +
+
+
+ ); +} + +export default App; diff --git a/src/App.test.js b/src/App.test.js new file mode 100644 index 0000000..1f03afe --- /dev/null +++ b/src/App.test.js @@ -0,0 +1,8 @@ +import { render, screen } from '@testing-library/react'; +import App from './App'; + +test('renders learn react link', () => { + render(); + const linkElement = screen.getByText(/learn react/i); + expect(linkElement).toBeInTheDocument(); +}); diff --git a/src/Components/Content/Content.js b/src/Components/Content/Content.js new file mode 100644 index 0000000..6802187 --- /dev/null +++ b/src/Components/Content/Content.js @@ -0,0 +1,84 @@ +import React, { createContext, useContext, useState } from "react"; +import { useSelector } from "react-redux"; +import classes from "./Content.module.css"; +import HeadChecker from "./HeadChecker/HeadChecker"; +import HeadIcons from "./HeadIcons/HeadIcons"; +import Pagination from "./Pagination/Pagination"; +import { Switch, Route } from "react-router-dom"; +import Starred from "./Starred/Starred"; +import Snooze from "./Snooze/Snooze"; +import MailBox from "../SideBar/MailBox/MailBox"; +import SendMail from "./SendMail/SendMail"; +import Message from "./messageShow/MessageShow"; + +export const PageContext = createContext(); + +function Content() { + const email = useSelector((state) => state.searchReducer); + const [currentPage, setCurrentPage] = useState(1); + const goToNextPage = () => { + return setCurrentPage(currentPage + 1); + }; + + const goToPreviousPage = () => { + return setCurrentPage(currentPage > 1 ? currentPage - 1 : currentPage); + }; + const obj = { + goToNextPage, + goToPreviousPage + }; + return ( + +
+ + + + + + + + + +
+ +
+ + + +
+

Drafts

+
+ + + +
+ +
+ + + +
+ +
+ + + +
+ +
+
+ +
+
+
+
+
+ ); +} + +export default Content; +export const usePageContext = () => useContext(PageContext); diff --git a/src/Components/Content/Content.module.css b/src/Components/Content/Content.module.css new file mode 100644 index 0000000..e69de29 diff --git a/src/Components/Content/Emails/Email.js b/src/Components/Content/Emails/Email.js new file mode 100644 index 0000000..42ed3a5 --- /dev/null +++ b/src/Components/Content/Emails/Email.js @@ -0,0 +1,123 @@ +import React, { useState } from "react"; +import { AiOutlineStar, AiFillDelete } from "react-icons/ai"; +import { BiMailSend } from "react-icons/bi"; +import { IoArchive, IoMdMailUnread } from "react-icons/io"; +import { BiAlarmSnooze } from "react-icons/bi"; +import classes from "./Emails.module.css"; +import { useDispatch, useSelector } from "react-redux"; +import { addInToSnooze, removeIntoSnooze } from "../../../redux/action/snooze"; +import { useHistory } from "react-router-dom"; +import { + addIdIntoStarred, + removeIdIntoStarred +} from "../../../redux/action/starred"; +import AccessAlarmIcon from "@material-ui/icons/AccessAlarm"; +import sendMessageData from "../../../redux/action/showMessage"; +import { deleteMail } from "../../../redux/action/search"; +import { + addToSelected, + remFromSelected +} from "../../../redux/action/mailSelectAct"; + +function Email({ id, company, description, subject, time }) { + const history = useHistory(); + const [showOnHover, setShowOnHover] = useState(false); + const [starColorShow, setStarColorShow] = useState(false); + const [addSnooze, setAddSnooze] = useState(false); + const dispatch = useDispatch(); + + const handlingShowOnOver = (e) => { + e.stopPropagation(); + setShowOnHover((prev) => (prev = true)); + }; + + const handlingShowOnOut = (e) => { + e.stopPropagation(); + setShowOnHover((prev) => (prev = false)); + }; + + const starClick = (e) => { + e.preventDefault(); + setStarColorShow((prev) => !prev); + if (!starColorShow) { + dispatch(addIdIntoStarred(id)); + } else if (starColorShow) { + dispatch(removeIdIntoStarred(id)); + } + }; + + const snoozeHandler = (e) => { + setAddSnooze(!addSnooze); + if (!addSnooze) { + console.log("run"); + dispatch(addInToSnooze(id)); + } else if (addSnooze) { + console.log("run1"); + dispatch(removeIntoSnooze(id)); + } + }; + + function showMail(e) { + dispatch(sendMessageData(id, company, description, subject, time)); + history.push("/mail"); + } + + function handleDelete() { + dispatch(deleteMail(id)); + } + + function selectBox(e) { + if (e.target.checked) { + dispatch(addToSelected(id)); + } else { + dispatch(remFromSelected(id)); + } + } + + return ( + +
+
+ + + +
+
+
+

{company}

+

{description}

+
+ {showOnHover ? ( +
+ + + +
+ ) : ( +

{time}

+ )} +
+
+
+
+ ); +} + +export default Email; diff --git a/src/Components/Content/Emails/Emails.module.css b/src/Components/Content/Emails/Emails.module.css new file mode 100644 index 0000000..982156b --- /dev/null +++ b/src/Components/Content/Emails/Emails.module.css @@ -0,0 +1,69 @@ +.list:hover { + box-shadow: 5px 5px 10px 5px rgb(226 232 236 / 50%); +} +.svg { + width: 1.3em; + height: 1.3em; +} +.svgStar { + fill: red; +} +.check { + display: flex; + align-items: center; +} +.list { + display: flex; + align-items: center; +} +.company { + display: flex; + justify-content: space-between; + align-items: center; + width: 100%; +} +.company > h3 { + font-weight: 500; + font-size: 1.2rem; + margin-left: 20px; + flex-grow: 1; +} +.company > h4 { + flex-grow: 3; +} +.company > p { + padding-right: 10px; +} +.hideIcons > button { + /* margin-right: 0px; */ + cursor: pointer; + background: none; + border: none; + width: 30px; + padding: 0; +} +.button { + margin-left: 10px; + background: none; + border: none; +} +.button:hover { + background: #f1f3f4; +} +/* .hideIcons { + background: red; +} */ +.hideIcons > button :hover { + background: #f1f3f4; +} + +.middle { + display: flex; + justify-content: space-evenly; +} +.middle > h3 { + margin-left: 40px; +} +.middle > h4 { + margin-left: 100px; +} diff --git a/src/Components/Content/HeadChecker/HeadChecker.js b/src/Components/Content/HeadChecker/HeadChecker.js new file mode 100644 index 0000000..a2d64fc --- /dev/null +++ b/src/Components/Content/HeadChecker/HeadChecker.js @@ -0,0 +1,91 @@ +import React, { useState } from "react"; +import refresh from "../Images/refresh.png"; +import more from "../Images/more.png"; +import left from "../Images/left-arrow.png"; +import right from "../Images/right-arrow.png"; +import classes from "./HeadChecker.module.css"; +import { usePageContext } from "../Content"; +import ArchiveIcon from "@material-ui/icons/Archive"; +import ReportIcon from "@material-ui/icons/Report"; +import DeleteIcon from "@material-ui/icons/Delete"; +import MarkunreadIcon from "@material-ui/icons/Markunread"; +import WatchLaterIcon from "@material-ui/icons/WatchLater"; +import LabelIcon from "@material-ui/icons/Label"; +import CreateNewFolderIcon from "@material-ui/icons/CreateNewFolder"; +import AssignmentTurnedInIcon from "@material-ui/icons/AssignmentTurnedIn"; +import MoreVertIcon from "@material-ui/icons/MoreVert"; +import ArrowBackIcon from "@material-ui/icons/ArrowBack"; +import { useHistory } from "react-router-dom"; +import { useDispatch, useSelector } from "react-redux"; +import { deleteMultiple } from "../../../redux/action/search"; +import { emptySelected } from "../../../redux/action/mailSelectAct"; + +function HeadChecker() { + const selectedMails = useSelector((state) => state.mailSelectRed); + + const notChecked = ( +
+ + +
+ ); + const [checked, setCheckBox] = useState(notChecked); + + const navigate = ( +
+ + + + + + + + + +
+ ); + + function showIcons(e) { + if (e.target.checked === true) { + setCheckBox(navigate); + } else { + setCheckBox(notChecked); + } + } + + const dispatch = useDispatch(); + + function deleteMul() { + dispatch(deleteMultiple(selectedMails)); + dispatch(emptySelected()); + } + + const obj = usePageContext(); + return ( +
+
+ + {checked} +
+
+ + +
+
+ ); +} + +export default HeadChecker; diff --git a/src/Components/Content/HeadChecker/HeadChecker.module.css b/src/Components/Content/HeadChecker/HeadChecker.module.css new file mode 100644 index 0000000..d32b6e5 --- /dev/null +++ b/src/Components/Content/HeadChecker/HeadChecker.module.css @@ -0,0 +1,44 @@ +.head { + display: flex; + justify-content: space-between; +} + +.headchecker > button { + cursor: pointer; + padding: 10px; + background: none; + border: none; + margin: 0px 10px; + border-radius: 50%; +} +.headchecker > button:hover { + background: #f1f3f4; +} + +.headchecker > button > img { + width: 14px; +} + +.navigate { + display: flex; + margin-top: 15px; +} +.navigate > svg { + margin-right: 30px; +} + +.navigate > button { + background: none; + border: none; + margin-right: 20px; + cursor: pointer; +} + +.headchecker { + display: flex; + /* justify-content: center; + align-content: center; */ +} +.headchecker > input { + align-items: center; +} diff --git a/src/Components/Content/HeadIcons/HeadIcons.js b/src/Components/Content/HeadIcons/HeadIcons.js new file mode 100644 index 0000000..a15517d --- /dev/null +++ b/src/Components/Content/HeadIcons/HeadIcons.js @@ -0,0 +1,25 @@ +import React from "react"; +import classes from "./HeadIcons.module.css"; +import mail from "../Images/mail-inbox-app.png"; +import tag from "../Images/tag.png"; +import user from "../Images/user.png"; +function HeadIcons() { + return ( +
+ + + +
+ ); +} + +export default HeadIcons; diff --git a/src/Components/Content/HeadIcons/HeadIcons.module.css b/src/Components/Content/HeadIcons/HeadIcons.module.css new file mode 100644 index 0000000..7cbef5f --- /dev/null +++ b/src/Components/Content/HeadIcons/HeadIcons.module.css @@ -0,0 +1,24 @@ +.container { + display: flex; + justify-content: space-around; +} + +.btn { + background: none; + display: flex; + border: none; + align-items: center; + flex-grow: 1; +} +.btn:hover { + background: #f1f3f4; +} +.btn > p { + font-weight: 600; +} + +.btn > img { + margin-right: 30px; + width: 18px; + padding: 5px; +} diff --git a/src/Components/Content/Images/left-arrow.png b/src/Components/Content/Images/left-arrow.png new file mode 100644 index 0000000..72a27ff Binary files /dev/null and b/src/Components/Content/Images/left-arrow.png differ diff --git a/src/Components/Content/Images/mail-inbox-app.png b/src/Components/Content/Images/mail-inbox-app.png new file mode 100644 index 0000000..6299eb2 Binary files /dev/null and b/src/Components/Content/Images/mail-inbox-app.png differ diff --git a/src/Components/Content/Images/more.png b/src/Components/Content/Images/more.png new file mode 100644 index 0000000..8f32300 Binary files /dev/null and b/src/Components/Content/Images/more.png differ diff --git a/src/Components/Content/Images/refresh.png b/src/Components/Content/Images/refresh.png new file mode 100644 index 0000000..0fb83be Binary files /dev/null and b/src/Components/Content/Images/refresh.png differ diff --git a/src/Components/Content/Images/right-arrow.png b/src/Components/Content/Images/right-arrow.png new file mode 100644 index 0000000..012e4f8 Binary files /dev/null and b/src/Components/Content/Images/right-arrow.png differ diff --git a/src/Components/Content/Images/tag.png b/src/Components/Content/Images/tag.png new file mode 100644 index 0000000..e5ade08 Binary files /dev/null and b/src/Components/Content/Images/tag.png differ diff --git a/src/Components/Content/Images/user.png b/src/Components/Content/Images/user.png new file mode 100644 index 0000000..66987d8 Binary files /dev/null and b/src/Components/Content/Images/user.png differ diff --git a/src/Components/Content/Pagination/Pagination.js b/src/Components/Content/Pagination/Pagination.js new file mode 100644 index 0000000..480f754 --- /dev/null +++ b/src/Components/Content/Pagination/Pagination.js @@ -0,0 +1,33 @@ +import React, { useState } from "react"; +import Email from "../Emails/Email"; +import { useSelector } from "react-redux"; + +function Pagination({ data, dataLimit, currentPage }) { + // const page = Math.round(data.length / dataLimit); + const getPaginatedData = () => { + const startIndex = currentPage * dataLimit - dataLimit; + const endIndex = startIndex + dataLimit; + const newData = Object.values(data); + return newData.slice(startIndex, endIndex); + }; + + // const obj = [goToNextPage, goToPreviousPage]; + return ( +
+ {getPaginatedData().map((d, i) => { + return ( + + ); + })} +
+ ); +} + +export default Pagination; diff --git a/src/Components/Content/Pagination/Pagination.module.css b/src/Components/Content/Pagination/Pagination.module.css new file mode 100644 index 0000000..e69de29 diff --git a/src/Components/Content/SendMail/SendMail.js b/src/Components/Content/SendMail/SendMail.js new file mode 100644 index 0000000..30d94ec --- /dev/null +++ b/src/Components/Content/SendMail/SendMail.js @@ -0,0 +1,14 @@ +import React from "react"; +import { useSelector } from "react-redux"; +import Pagination from "../Pagination/Pagination"; + +function SendMail() { + const sentData = useSelector((state) => state.sentReducer); + return ( +
+ +
+ ); +} + +export default SendMail; diff --git a/src/Components/Content/Snooze/Snooze.js b/src/Components/Content/Snooze/Snooze.js new file mode 100644 index 0000000..c357f5d --- /dev/null +++ b/src/Components/Content/Snooze/Snooze.js @@ -0,0 +1,18 @@ +import React from "react"; +import { useSelector } from "react-redux"; +import Pagination from "../Pagination/Pagination"; +import snoozeReducer from "../../../redux/reducers/snoozeReducer"; + +function Snooze() { + const email = useSelector((state) => state.searchReducer); + const snoozeddId = useSelector((state) => state.snoozeReducer); + const snoozedData = email.filter((val) => snoozeddId.includes(val.id)); + + return ( +
+ +
+ ); +} + +export default Snooze; diff --git a/src/Components/Content/Starred/Starred.js b/src/Components/Content/Starred/Starred.js new file mode 100644 index 0000000..b7edbe0 --- /dev/null +++ b/src/Components/Content/Starred/Starred.js @@ -0,0 +1,40 @@ +import React, { useState } from "react"; +import { useSelector } from "react-redux"; +import Pagination from "../Pagination/Pagination"; +import classes from "./Starred.module.css"; + +function Starred() { + const [currentPage, setCurrentPage] = useState(1); + const goToNextPage = () => { + return setCurrentPage(currentPage + 1); + }; + + const goToPreviousPage = () => { + return setCurrentPage(currentPage > 1 ? currentPage - 1 : currentPage); + }; + // const obj = { + // goToNextPage, + // goToPreviousPage, + // }; + const email = useSelector((state) => state.searchReducer); + const starredId = useSelector((state) => state.starredReducer); + const starredData = email.filter((val) => starredId.includes(val.id)); + + // let starredData = []; + // starredId.forEach((element) => { + // starredData.push( + // email.filter((val) => { + // return val.id === element; + // })[0] + // ); + // }); + + console.log(starredData); + return ( +
+ +
+ ); +} + +export default Starred; diff --git a/src/Components/Content/Starred/Starred.module.css b/src/Components/Content/Starred/Starred.module.css new file mode 100644 index 0000000..e69de29 diff --git a/src/Components/Content/messageShow/MessageShow.js b/src/Components/Content/messageShow/MessageShow.js new file mode 100644 index 0000000..5b2a567 --- /dev/null +++ b/src/Components/Content/messageShow/MessageShow.js @@ -0,0 +1,51 @@ +import { React } from "react"; +import "./messageShow.css"; +import ArchiveIcon from "@material-ui/icons/Archive"; +import ReportIcon from "@material-ui/icons/Report"; +import DeleteIcon from "@material-ui/icons/Delete"; +import MarkunreadIcon from "@material-ui/icons/Markunread"; +import WatchLaterIcon from "@material-ui/icons/WatchLater"; +import LabelIcon from "@material-ui/icons/Label"; +import CreateNewFolderIcon from "@material-ui/icons/CreateNewFolder"; +import AssignmentTurnedInIcon from "@material-ui/icons/AssignmentTurnedIn"; +import MoreVertIcon from "@material-ui/icons/MoreVert"; +import ArrowBackIcon from "@material-ui/icons/ArrowBack"; +import { useHistory } from "react-router-dom"; +import { useSelector } from "react-redux"; + +export default function Message(props) { + const history = useHistory(); + + const mailData = useSelector((state) => state.showMessage); + // console.log(mailData); + function navigateBack() { + history.push("/"); + } + + const navigate = ( +
+ + + + + + + + + + +
+ ); + + return ( +
+ {navigate} +

{mailData.company_Name}

+ +
{mailData.description}
+

{mailData.subject}

+
+ ); +} diff --git a/src/Components/Content/messageShow/messageShow.css b/src/Components/Content/messageShow/messageShow.css new file mode 100644 index 0000000..d9e41a7 --- /dev/null +++ b/src/Components/Content/messageShow/messageShow.css @@ -0,0 +1,28 @@ +.navigate { + display: flex; + margin-top: 15px; +} +.navigate > svg { + margin-right: 30px; +} + +.navigate > button { + background: none; + border: none; + margin-right: 20px; + cursor: pointer; +} +.sender { + margin-top: 3vh; + float: left; +} +.subject { + margin-top: 4vh; +} +.description { + margin-top: 10vh; +} +.label { + margin-top: 25px; + margin-left: 15px; +} diff --git a/src/Components/Navigation/IconButton/IconButton.js b/src/Components/Navigation/IconButton/IconButton.js new file mode 100644 index 0000000..015c22f --- /dev/null +++ b/src/Components/Navigation/IconButton/IconButton.js @@ -0,0 +1,12 @@ +import React from "react"; +import classes from "./IconButton.module.css"; + +function IconButton(props) { + return ( + + ); +} + +export default IconButton; diff --git a/src/Components/Navigation/IconButton/IconButton.module.css b/src/Components/Navigation/IconButton/IconButton.module.css new file mode 100644 index 0000000..d03351d --- /dev/null +++ b/src/Components/Navigation/IconButton/IconButton.module.css @@ -0,0 +1,16 @@ +.button { + padding: 5px; + background: none; + border: none; + margin-right: 15px; + border-radius: 50%; + cursor: pointer; +} + +.button:hover { + background: #f1f3f4; +} + +.button > img { + width: 20px; +} diff --git a/src/Components/Navigation/Images/dots-menu.png b/src/Components/Navigation/Images/dots-menu.png new file mode 100644 index 0000000..341d97c Binary files /dev/null and b/src/Components/Navigation/Images/dots-menu.png differ diff --git a/src/Components/Navigation/Images/doubts-button.png b/src/Components/Navigation/Images/doubts-button.png new file mode 100644 index 0000000..8183372 Binary files /dev/null and b/src/Components/Navigation/Images/doubts-button.png differ diff --git a/src/Components/Navigation/Images/gmaillogo.png b/src/Components/Navigation/Images/gmaillogo.png new file mode 100644 index 0000000..6328341 Binary files /dev/null and b/src/Components/Navigation/Images/gmaillogo.png differ diff --git a/src/Components/Navigation/Images/man.png b/src/Components/Navigation/Images/man.png new file mode 100644 index 0000000..d8ae7b2 Binary files /dev/null and b/src/Components/Navigation/Images/man.png differ diff --git a/src/Components/Navigation/Images/menu.png b/src/Components/Navigation/Images/menu.png new file mode 100644 index 0000000..755e3f3 Binary files /dev/null and b/src/Components/Navigation/Images/menu.png differ diff --git a/src/Components/Navigation/Images/search.png b/src/Components/Navigation/Images/search.png new file mode 100644 index 0000000..66af7b0 Binary files /dev/null and b/src/Components/Navigation/Images/search.png differ diff --git a/src/Components/Navigation/Images/settings.png b/src/Components/Navigation/Images/settings.png new file mode 100644 index 0000000..32756db Binary files /dev/null and b/src/Components/Navigation/Images/settings.png differ diff --git a/src/Components/Navigation/Navbar.js b/src/Components/Navigation/Navbar.js new file mode 100644 index 0000000..d1a103a --- /dev/null +++ b/src/Components/Navigation/Navbar.js @@ -0,0 +1,33 @@ +import React from "react"; +import classes from "./Navbar.module.css"; +import glogo from "./Images/gmaillogo.png"; +import menu from "./Images/menu.png"; +import SearchBar from "./SearchBar/SearchBar"; +import IconButton from "./IconButton/IconButton"; +import doubt from "./Images/doubts-button.png"; +import dot from "./Images/dots-menu.png"; +import man from "./Images/man.png"; + +import setting from "./Images/settings.png"; + +function Navbar() { + return ( +
+
+ + glogo +
+ +
+ + + + +
+
+ ); +} + +export default Navbar; diff --git a/src/Components/Navigation/Navbar.module.css b/src/Components/Navigation/Navbar.module.css new file mode 100644 index 0000000..8125c2a --- /dev/null +++ b/src/Components/Navigation/Navbar.module.css @@ -0,0 +1,32 @@ +.navbar { + display: flex; + flex-direction: row; + align-items: center; + justify-content: space-between; +} + +.menuBrand { + display: flex; + padding: 20px; + margin-right: 80px; +} + +.menuBrand > button { + padding: 3px; + background: none; + border: none; + cursor: pointer; +} + +.menuBrand > button:hover { + background: rgb(223, 190, 190); +} + +.menuBrand > button > img { + width: 20px; +} + +.menuBrand > img { + width: 120px; + margin-left: 30px; +} diff --git a/src/Components/Navigation/SearchBar/SearchBar.js b/src/Components/Navigation/SearchBar/SearchBar.js new file mode 100644 index 0000000..8069912 --- /dev/null +++ b/src/Components/Navigation/SearchBar/SearchBar.js @@ -0,0 +1,41 @@ +import React from "react"; +import classes from "./SearchBar.module.css"; +import { useDispatch } from "react-redux"; +import { useState } from "react"; +import search from "../Images/search.png"; +import { dataReset, searchResult } from "../../../redux/action/search"; + +function SearchBar() { + const [searchText, setSearchText] = useState(""); + const dispatch = useDispatch(); + const gatherSearchData = (e) => { + e.preventDefault(); + setSearchText(e.target.value); + }; + const handlingSearch = (e) => { + e.preventDefault(); + if (searchText.length === 0) { + // console.log("lkdl"); + dispatch(dataReset()); + } else { + dispatch(searchResult(searchText)); + } + }; + // console.log(searchText); + return ( +
+
+ search + +
+
+ ); +} + +export default SearchBar; diff --git a/src/Components/Navigation/SearchBar/SearchBar.module.css b/src/Components/Navigation/SearchBar/SearchBar.module.css new file mode 100644 index 0000000..df7f349 --- /dev/null +++ b/src/Components/Navigation/SearchBar/SearchBar.module.css @@ -0,0 +1,26 @@ +.search { + display: flex; + padding: 5px; + background: #f1f3f4; + border: none; + border-radius: 8px; + /* width: 100%; */ +} + +.searchIcon { + width: 20px; + margin-right: 10px; +} + +.input { + /* padding: 5px; */ + display: block; + border: none; + width: 100%; +} + +.form { + width: 50%; + flex-grow: 1; + margin-right: 150px; +} diff --git a/src/Components/SideBar/ComposeButton/ComposeButton.js b/src/Components/SideBar/ComposeButton/ComposeButton.js new file mode 100644 index 0000000..ed3fccb --- /dev/null +++ b/src/Components/SideBar/ComposeButton/ComposeButton.js @@ -0,0 +1,12 @@ +import React from "react"; +import classes from "./ComposeButton.module.css"; +function ComposeButton() { + return ( + + ); +} + +export default ComposeButton; diff --git a/src/Components/SideBar/ComposeButton/ComposeButton.module.css b/src/Components/SideBar/ComposeButton/ComposeButton.module.css new file mode 100644 index 0000000..9d8e2a4 --- /dev/null +++ b/src/Components/SideBar/ComposeButton/ComposeButton.module.css @@ -0,0 +1,21 @@ +.compose { + display: flex; + align-items: center; + box-shadow: 0 1px 2px 0 rgb(60 64 67 / 30%), 0 1px 3px 1px rgb(60 64 67 / 15%); + border-radius: 40px; + background: none; + padding: 5px; + border: none; + cursor: pointer; + /* justify-content: center; */ +} + +.compose > span { + font-size: 40px; + margin-right: 10px; + margin-left: 10px; +} + +.compose > h4 { + margin: 0px 10px; +} diff --git a/src/Components/SideBar/Images/mail-inbox-app.png b/src/Components/SideBar/Images/mail-inbox-app.png new file mode 100644 index 0000000..6299eb2 Binary files /dev/null and b/src/Components/SideBar/Images/mail-inbox-app.png differ diff --git a/src/Components/SideBar/Images/notes.png b/src/Components/SideBar/Images/notes.png new file mode 100644 index 0000000..db9e549 Binary files /dev/null and b/src/Components/SideBar/Images/notes.png differ diff --git a/src/Components/SideBar/Images/pointed-star.png b/src/Components/SideBar/Images/pointed-star.png new file mode 100644 index 0000000..ee5bf06 Binary files /dev/null and b/src/Components/SideBar/Images/pointed-star.png differ diff --git a/src/Components/SideBar/Images/right-arrow.png b/src/Components/SideBar/Images/right-arrow.png new file mode 100644 index 0000000..2e84c76 Binary files /dev/null and b/src/Components/SideBar/Images/right-arrow.png differ diff --git a/src/Components/SideBar/Images/snooze.png b/src/Components/SideBar/Images/snooze.png new file mode 100644 index 0000000..f785128 Binary files /dev/null and b/src/Components/SideBar/Images/snooze.png differ diff --git a/src/Components/SideBar/LIstItems/ListItem.module.css b/src/Components/SideBar/LIstItems/ListItem.module.css new file mode 100644 index 0000000..be6d6c7 --- /dev/null +++ b/src/Components/SideBar/LIstItems/ListItem.module.css @@ -0,0 +1,26 @@ +.ul { + list-style: none; + padding: 0; +} +.ul > li { + padding: 7px; + display: flex; + align-items: center; + border-top-right-radius: 20px; + border-bottom-right-radius: 20px; + font-weight: bold; +} + +.ul > li:hover { + background-color: #f1f3f4; +} + +.ul > li > img { + width: 16px; + margin-right: 25px; +} +.listItem { + margin-top: 20px; + padding: 5px 10px; + padding-left: 0; +} diff --git a/src/Components/SideBar/LIstItems/ListItems.js b/src/Components/SideBar/LIstItems/ListItems.js new file mode 100644 index 0000000..6ee2827 --- /dev/null +++ b/src/Components/SideBar/LIstItems/ListItems.js @@ -0,0 +1,48 @@ +import React from "react"; +import classes from "./ListItem.module.css"; +import mail from "../Images/mail-inbox-app.png"; +import star from "../Images/pointed-star.png"; +import snooze from "../Images/snooze.png"; +import sent from "../Images/right-arrow.png"; +import draft from "../Images/notes.png"; +import { Link } from "react-router-dom"; +function ListItems() { + return ( +
+ +
+ ); +} + +export default ListItems; diff --git a/src/Components/SideBar/MailBox/MailBox.js b/src/Components/SideBar/MailBox/MailBox.js new file mode 100644 index 0000000..b9d9f2f --- /dev/null +++ b/src/Components/SideBar/MailBox/MailBox.js @@ -0,0 +1,48 @@ +import React, { useState } from "react"; +import { useDispatch } from "react-redux"; +import { send } from "../../../redux/action/send"; + +import classes from "./MailBox.module.css"; +function MailBox() { + const dispatch = useDispatch(); + const [email, setEmail] = useState(""); + const [subject, setSubject] = useState(""); + const [textBox, setTextBox] = useState(""); + const sendersHandler = (e) => { + setEmail(e.target.value); + }; + const subjectHandler = (e) => { + setSubject(e.target.value); + }; + const textBoxHandler = (e) => { + setTextBox(e.target.value); + }; + + const submitHandler = (e) => { + e.preventDefault(); + let id = Date.now(); + let time = new Date().toLocaleDateString(); + dispatch(send(id, email, subject, textBox, time)); + }; + + return ( +
+ + +