├── .gitignore ├── .idea ├── .gitignore ├── inspectionProfiles │ └── Project_Default.xml ├── modules.xml ├── prettier.xml ├── react-blog.iml └── vcs.xml ├── README.md ├── package-lock.json ├── package.json ├── public ├── favicon.ico ├── index.html ├── logo192.png ├── logo512.png ├── manifest.json ├── noavatar.png └── robots.txt └── src ├── App.js ├── components ├── AddComment │ ├── AddComment.module.scss │ └── index.jsx ├── CommentsBlock.jsx ├── Header │ ├── Header.module.scss │ └── index.jsx ├── Post │ ├── Post.module.scss │ ├── Skeleton.jsx │ └── index.jsx ├── SideBlock │ ├── SideBlock.module.scss │ └── index.jsx ├── TagsBlock.jsx ├── UserInfo │ ├── UserInfo.module.scss │ └── index.jsx └── index.js ├── index.js ├── index.scss ├── pages ├── AddPost │ ├── AddPost.module.scss │ └── index.jsx ├── FullPost.jsx ├── Home.jsx ├── Login │ ├── Login.module.scss │ └── index.jsx ├── Registration │ ├── Login.module.scss │ └── index.jsx └── index.js └── theme.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 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/prettier.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | -------------------------------------------------------------------------------- /.idea/react-blog.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Getting Started with Create React App 2 | 3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 4 | 5 | ## Available Scripts 6 | 7 | In the project directory, you can run: 8 | 9 | ### `npm start` 10 | 11 | Runs the app in the development mode.\ 12 | Open [http://localhost:3000](http://localhost:3000) to view it in your browser. 13 | 14 | The page will reload when you make changes.\ 15 | You may also see any lint errors in the console. 16 | 17 | ### `npm test` 18 | 19 | Launches the test runner in the interactive watch mode.\ 20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 21 | 22 | ### `npm run build` 23 | 24 | Builds the app for production to the `build` folder.\ 25 | It correctly bundles React in production mode and optimizes the build for the best performance. 26 | 27 | The build is minified and the filenames include the hashes.\ 28 | Your app is ready to be deployed! 29 | 30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 31 | 32 | ### `npm run eject` 33 | 34 | **Note: this is a one-way operation. Once you `eject`, you can't go back!** 35 | 36 | 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. 37 | 38 | 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. 39 | 40 | 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. 41 | 42 | ## Learn More 43 | 44 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 45 | 46 | To learn React, check out the [React documentation](https://reactjs.org/). 47 | 48 | ### Code Splitting 49 | 50 | 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) 51 | 52 | ### Analyzing the Bundle Size 53 | 54 | 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) 55 | 56 | ### Making a Progressive Web App 57 | 58 | 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) 59 | 60 | ### Advanced Configuration 61 | 62 | 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) 63 | 64 | ### Deployment 65 | 66 | This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) 67 | 68 | ### `npm run build` fails to minify 69 | 70 | 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) 71 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-blog", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@emotion/react": "^11.9.0", 7 | "@emotion/styled": "^11.8.1", 8 | "@mui/icons-material": "^5.8.0", 9 | "@mui/material": "^5.8.0", 10 | "@reduxjs/toolkit": "^1.8.2", 11 | "@testing-library/jest-dom": "^5.16.4", 12 | "@testing-library/react": "^13.2.0", 13 | "@testing-library/user-event": "^13.5.0", 14 | "axios": "^0.27.2", 15 | "clsx": "^1.1.1", 16 | "easymde": "^2.16.1", 17 | "prettier": "^2.6.2", 18 | "react": "^18.1.0", 19 | "react-dom": "^18.1.0", 20 | "react-hook-form": "^7.32.0", 21 | "react-markdown": "^8.0.3", 22 | "react-redux": "^8.0.2", 23 | "react-router-dom": "^6.3.0", 24 | "react-scripts": "5.0.1", 25 | "react-simplemde-editor": "^5.0.2", 26 | "sass": "^1.52.1", 27 | "web-vitals": "^2.1.4" 28 | }, 29 | "scripts": { 30 | "start": "react-scripts start", 31 | "build": "react-scripts build", 32 | "test": "react-scripts test", 33 | "eject": "react-scripts eject" 34 | }, 35 | "eslintConfig": { 36 | "extends": [ 37 | "react-app", 38 | "react-app/jest" 39 | ] 40 | }, 41 | "browserslist": { 42 | "production": [ 43 | ">0.2%", 44 | "not dead", 45 | "not op_mini all" 46 | ], 47 | "development": [ 48 | "last 1 chrome version", 49 | "last 1 firefox version", 50 | "last 1 safari version" 51 | ] 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Archakov06/mern-blog-frontend/fe77af2fd7184b380bcbc7c390f35cca252268a0/public/favicon.ico -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 22 | 31 | React Blog 32 | 33 | 34 | 35 |
36 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Archakov06/mern-blog-frontend/fe77af2fd7184b380bcbc7c390f35cca252268a0/public/logo192.png -------------------------------------------------------------------------------- /public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Archakov06/mern-blog-frontend/fe77af2fd7184b380bcbc7c390f35cca252268a0/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/noavatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Archakov06/mern-blog-frontend/fe77af2fd7184b380bcbc7c390f35cca252268a0/public/noavatar.png -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /src/App.js: -------------------------------------------------------------------------------- 1 | import Container from "@mui/material/Container"; 2 | 3 | import { Header } from "./components"; 4 | import { Home, FullPost, Registration, AddPost, Login } from "./pages"; 5 | 6 | function App() { 7 | return ( 8 | <> 9 |
10 | 11 | 12 | {/**/} 13 | {/**/} 14 | {/**/} 15 | {/**/} 16 | 17 | 18 | ); 19 | } 20 | 21 | export default App; 22 | -------------------------------------------------------------------------------- /src/components/AddComment/AddComment.module.scss: -------------------------------------------------------------------------------- 1 | .root { 2 | display: flex; 3 | margin-top: 10px; 4 | padding-bottom: 20px; 5 | margin-right: 20px; 6 | margin-left: 17px; 7 | } 8 | 9 | .avatar { 10 | margin-right: 15px; 11 | } 12 | 13 | .form { 14 | width: 100%; 15 | 16 | button { 17 | margin-top: 10px; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/components/AddComment/index.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | import styles from "./AddComment.module.scss"; 4 | 5 | import TextField from "@mui/material/TextField"; 6 | import Avatar from "@mui/material/Avatar"; 7 | import Button from "@mui/material/Button"; 8 | 9 | export const Index = () => { 10 | return ( 11 | <> 12 |
13 | 17 |
18 | 25 | 26 |
27 |
28 | 29 | ); 30 | }; 31 | -------------------------------------------------------------------------------- /src/components/CommentsBlock.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | import { SideBlock } from "./SideBlock"; 4 | import ListItem from "@mui/material/ListItem"; 5 | import ListItemAvatar from "@mui/material/ListItemAvatar"; 6 | import Avatar from "@mui/material/Avatar"; 7 | import ListItemText from "@mui/material/ListItemText"; 8 | import Divider from "@mui/material/Divider"; 9 | import List from "@mui/material/List"; 10 | import Skeleton from "@mui/material/Skeleton"; 11 | 12 | export const CommentsBlock = ({ items, children, isLoading = true }) => { 13 | return ( 14 | 15 | 16 | {(isLoading ? [...Array(5)] : items).map((obj, index) => ( 17 | 18 | 19 | 20 | {isLoading ? ( 21 | 22 | ) : ( 23 | 24 | )} 25 | 26 | {isLoading ? ( 27 |
28 | 29 | 30 |
31 | ) : ( 32 | 36 | )} 37 |
38 | 39 |
40 | ))} 41 |
42 | {children} 43 |
44 | ); 45 | }; 46 | -------------------------------------------------------------------------------- /src/components/Header/Header.module.scss: -------------------------------------------------------------------------------- 1 | .root { 2 | background-color: #fff; 3 | padding: 10px 0; 4 | border-bottom: 1px solid #e0e0e0; 5 | margin-bottom: 30px; 6 | } 7 | 8 | .inner { 9 | display: flex; 10 | justify-content: space-between; 11 | } 12 | 13 | .logo { 14 | background-color: black; 15 | color: #fff; 16 | font-weight: 700; 17 | line-height: 35px; 18 | text-transform: uppercase; 19 | letter-spacing: 0.15px; 20 | border-radius: 5px; 21 | padding: 0 10px; 22 | text-decoration: none; 23 | 24 | &:hover { 25 | background-color: #4361ee; 26 | } 27 | } 28 | 29 | .buttons { 30 | button { 31 | margin-left: 10px; 32 | } 33 | 34 | a { 35 | text-decoration: none; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/components/Header/index.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Button from '@mui/material/Button'; 3 | 4 | import styles from './Header.module.scss'; 5 | import Container from '@mui/material/Container'; 6 | 7 | export const Header = () => { 8 | const isAuth = false; 9 | 10 | const onClickLogout = () => {}; 11 | 12 | return ( 13 |
14 | 15 |
16 | 17 |
ARCHAKOV BLOG
18 |
19 |
20 | {isAuth ? ( 21 | <> 22 | 23 | 24 | 25 | 28 | 29 | ) : ( 30 | <> 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | )} 39 |
40 |
41 |
42 |
43 | ); 44 | }; 45 | -------------------------------------------------------------------------------- /src/components/Post/Post.module.scss: -------------------------------------------------------------------------------- 1 | $blue: #4361ee; 2 | 3 | .root { 4 | background-color: #fff; 5 | border: 1px solid #dedede; 6 | border-radius: 6px; 7 | overflow: hidden; 8 | margin-bottom: 15px; 9 | position: relative; 10 | 11 | &:hover { 12 | border: 1px solid $blue; 13 | box-shadow: 0 0 0 1px $blue; 14 | 15 | .editButtons { 16 | opacity: 1; 17 | } 18 | } 19 | 20 | &Full { 21 | &:hover { 22 | background-color: #fff; 23 | border: 1px solid #dedede; 24 | box-shadow: none; 25 | } 26 | } 27 | } 28 | 29 | .image { 30 | width: 100%; 31 | height: 300px; 32 | object-fit: cover; 33 | 34 | &Full { 35 | min-height: 300px; 36 | height: 100%; 37 | } 38 | } 39 | 40 | .wrapper { 41 | padding: 10px 20px 20px; 42 | } 43 | 44 | .content { 45 | margin: 30px 0 50px; 46 | 47 | p { 48 | font-size: 22px; 49 | line-height: 36px; 50 | } 51 | } 52 | 53 | .indention { 54 | padding-left: 40px; 55 | } 56 | 57 | .title { 58 | font-size: 28px; 59 | margin: 0; 60 | 61 | a { 62 | text-decoration: none; 63 | color: #000; 64 | 65 | &:hover { 66 | color: $blue; 67 | } 68 | } 69 | 70 | &Full { 71 | font-size: 42px; 72 | font-weight: 900; 73 | } 74 | } 75 | 76 | .tags { 77 | list-style: none; 78 | padding: 0; 79 | margin: 5px 0 0 0; 80 | 81 | li { 82 | display: inline-block; 83 | font-size: 14px; 84 | margin-right: 15px; 85 | opacity: 0.5; 86 | 87 | &:hover { 88 | opacity: 1; 89 | } 90 | 91 | a { 92 | text-decoration: none; 93 | color: #000; 94 | } 95 | } 96 | } 97 | 98 | .postDetails { 99 | list-style: none; 100 | padding: 0; 101 | margin: 20px 0 0 0; 102 | 103 | li { 104 | display: inline-flex; 105 | align-items: center; 106 | font-size: 14px; 107 | margin-right: 20px; 108 | opacity: 0.5; 109 | 110 | svg { 111 | font-size: 18px; 112 | margin-right: 5px; 113 | } 114 | } 115 | } 116 | 117 | .skeleton { 118 | background-color: #fff; 119 | border: 1px solid #dedede; 120 | border-radius: 6px; 121 | overflow: hidden; 122 | margin-bottom: 15px; 123 | 124 | &Content { 125 | padding: 20px; 126 | } 127 | 128 | &Info { 129 | margin-left: 50px; 130 | } 131 | } 132 | 133 | .skeletonUser { 134 | display: flex; 135 | 136 | &Details { 137 | display: flex; 138 | flex-direction: column; 139 | } 140 | } 141 | 142 | .skeletonTags { 143 | display: flex; 144 | 145 | span { 146 | margin-right: 15px; 147 | } 148 | } 149 | 150 | .editButtons { 151 | position: absolute; 152 | right: 15px; 153 | top: 15px; 154 | background-color: rgba(255, 255, 255, 1); 155 | border-radius: 10px; 156 | opacity: 0; 157 | transition: all 0.15s ease-in-out; 158 | } 159 | -------------------------------------------------------------------------------- /src/components/Post/Skeleton.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import Stack from "@mui/material/Stack"; 3 | import Skeleton from "@mui/material/Skeleton"; 4 | 5 | import styles from "./Post.module.scss"; 6 | 7 | export const PostSkeleton = () => { 8 | return ( 9 |
10 | 11 | 12 |
13 |
14 | 20 |
21 | 22 | 23 |
24 |
25 |
26 | 27 |
28 | 29 | 30 | 31 |
32 |
33 |
34 |
35 |
36 | ); 37 | }; 38 | -------------------------------------------------------------------------------- /src/components/Post/index.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import clsx from 'clsx'; 3 | import IconButton from '@mui/material/IconButton'; 4 | import DeleteIcon from '@mui/icons-material/Clear'; 5 | import EditIcon from '@mui/icons-material/Edit'; 6 | import EyeIcon from '@mui/icons-material/RemoveRedEyeOutlined'; 7 | import CommentIcon from '@mui/icons-material/ChatBubbleOutlineOutlined'; 8 | 9 | import styles from './Post.module.scss'; 10 | import { UserInfo } from '../UserInfo'; 11 | import { PostSkeleton } from './Skeleton'; 12 | 13 | export const Post = ({ 14 | _id, 15 | title, 16 | createdAt, 17 | imageUrl, 18 | user, 19 | viewsCount, 20 | commentsCount, 21 | tags, 22 | children, 23 | isFullPost, 24 | isLoading, 25 | isEditable, 26 | }) => { 27 | if (isLoading) { 28 | return ; 29 | } 30 | 31 | const onClickRemove = () => {}; 32 | 33 | return ( 34 |
35 | {isEditable && ( 36 |
37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 |
46 | )} 47 | {imageUrl && ( 48 | {title} 53 | )} 54 |
55 | 56 |
57 |

58 | {isFullPost ? title : {title}} 59 |

60 |
    61 | {tags.map((name) => ( 62 |
  • 63 | #{name} 64 |
  • 65 | ))} 66 |
67 | {children &&
{children}
} 68 |
    69 |
  • 70 | 71 | {viewsCount} 72 |
  • 73 |
  • 74 | 75 | {commentsCount} 76 |
  • 77 |
78 |
79 |
80 |
81 | ); 82 | }; 83 | -------------------------------------------------------------------------------- /src/components/SideBlock/SideBlock.module.scss: -------------------------------------------------------------------------------- 1 | .root { 2 | margin-bottom: 20px; 3 | } 4 | 5 | .title { 6 | padding: 15px 15px 0 15px; 7 | } 8 | -------------------------------------------------------------------------------- /src/components/SideBlock/index.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import styles from "./SideBlock.module.scss"; 3 | import Typography from "@mui/material/Typography"; 4 | import Paper from "@mui/material/Paper"; 5 | 6 | export const SideBlock = ({ title, children }) => { 7 | return ( 8 | 9 | 10 | {title} 11 | 12 | {children} 13 | 14 | ); 15 | }; 16 | -------------------------------------------------------------------------------- /src/components/TagsBlock.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | import List from "@mui/material/List"; 4 | import ListItem from "@mui/material/ListItem"; 5 | import ListItemButton from "@mui/material/ListItemButton"; 6 | import ListItemIcon from "@mui/material/ListItemIcon"; 7 | import TagIcon from "@mui/icons-material/Tag"; 8 | import ListItemText from "@mui/material/ListItemText"; 9 | import Skeleton from "@mui/material/Skeleton"; 10 | 11 | import { SideBlock } from "./SideBlock"; 12 | 13 | export const TagsBlock = ({ items, isLoading = true }) => { 14 | return ( 15 | 16 | 17 | {(isLoading ? [...Array(5)] : items).map((name, i) => ( 18 | 22 | 23 | 24 | 25 | 26 | 27 | {isLoading ? ( 28 | 29 | ) : ( 30 | 31 | )} 32 | 33 | 34 | 35 | ))} 36 | 37 | 38 | ); 39 | }; 40 | -------------------------------------------------------------------------------- /src/components/UserInfo/UserInfo.module.scss: -------------------------------------------------------------------------------- 1 | .root { 2 | display: flex; 3 | align-items: center; 4 | } 5 | 6 | .avatar { 7 | width: 30px; 8 | height: 30px; 9 | border-radius: 30px; 10 | margin-right: 10px; 11 | } 12 | 13 | .userName { 14 | font-weight: 500; 15 | font-size: 14px; 16 | } 17 | 18 | .userDetails { 19 | display: flex; 20 | flex-direction: column; 21 | } 22 | 23 | .additional { 24 | font-size: 12px; 25 | opacity: 0.6; 26 | } 27 | -------------------------------------------------------------------------------- /src/components/UserInfo/index.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import styles from './UserInfo.module.scss'; 3 | 4 | export const UserInfo = ({ avatarUrl, fullName, additionalText }) => { 5 | return ( 6 |
7 | {fullName} 8 |
9 | {fullName} 10 | {additionalText} 11 |
12 |
13 | ); 14 | }; 15 | -------------------------------------------------------------------------------- /src/components/index.js: -------------------------------------------------------------------------------- 1 | export * from "./TagsBlock"; 2 | export * from "./CommentsBlock"; 3 | export * from "./Post"; 4 | export * from "./AddComment"; 5 | export * from "./SideBlock"; 6 | export * from "./UserInfo"; 7 | export * from "./Header"; 8 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom/client"; 3 | import App from "./App"; 4 | import CssBaseline from "@mui/material/CssBaseline"; 5 | 6 | import "./index.scss"; 7 | import { ThemeProvider } from "@mui/material"; 8 | import { theme } from "./theme"; 9 | 10 | const root = ReactDOM.createRoot(document.getElementById("root")); 11 | 12 | root.render( 13 | 14 | 15 | 16 | 17 | 18 | 19 | ); 20 | -------------------------------------------------------------------------------- /src/index.scss: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Roboto'; 4 | -webkit-font-smoothing: antialiased; 5 | -moz-osx-font-smoothing: grayscale; 6 | background-color: #F5F5F5 !important; 7 | } -------------------------------------------------------------------------------- /src/pages/AddPost/AddPost.module.scss: -------------------------------------------------------------------------------- 1 | .title { 2 | input { 3 | font-size: 42px; 4 | font-weight: 900; 5 | } 6 | 7 | div { 8 | &:before, 9 | &:after { 10 | display: none; 11 | } 12 | } 13 | } 14 | 15 | .image { 16 | width: 100%; 17 | } 18 | 19 | .tags { 20 | margin: 15px 0; 21 | } 22 | 23 | .editor { 24 | margin: 30px -30px; 25 | 26 | :global { 27 | .cm-s-easymde { 28 | border: 0; 29 | font-size: 22px; 30 | } 31 | .editor-toolbar { 32 | border: 0; 33 | background-color: rgb(0 0 0 / 2%); 34 | } 35 | } 36 | } 37 | 38 | .buttons { 39 | display: flex; 40 | 41 | button { 42 | margin-right: 15px; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/pages/AddPost/index.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import TextField from '@mui/material/TextField'; 3 | import Paper from '@mui/material/Paper'; 4 | import Button from '@mui/material/Button'; 5 | import SimpleMDE from 'react-simplemde-editor'; 6 | 7 | import 'easymde/dist/easymde.min.css'; 8 | import styles from './AddPost.module.scss'; 9 | 10 | export const AddPost = () => { 11 | const imageUrl = ''; 12 | const [value, setValue] = React.useState(''); 13 | 14 | const handleChangeFile = () => {}; 15 | 16 | const onClickRemoveImage = () => {}; 17 | 18 | const onChange = React.useCallback((value) => { 19 | setValue(value); 20 | }, []); 21 | 22 | const options = React.useMemo( 23 | () => ({ 24 | spellChecker: false, 25 | maxHeight: '400px', 26 | autofocus: true, 27 | placeholder: 'Введите текст...', 28 | status: false, 29 | autosave: { 30 | enabled: true, 31 | delay: 1000, 32 | }, 33 | }), 34 | [], 35 | ); 36 | 37 | return ( 38 | 39 | 42 | 43 | {imageUrl && ( 44 | 47 | )} 48 | {imageUrl && ( 49 | Uploaded 50 | )} 51 |
52 |
53 | 59 | 60 | 61 |
62 | 65 | 66 | 67 | 68 |
69 |
70 | ); 71 | }; 72 | -------------------------------------------------------------------------------- /src/pages/FullPost.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | import { Post } from "../components/Post"; 4 | import { Index } from "../components/AddComment"; 5 | import { CommentsBlock } from "../components/CommentsBlock"; 6 | 7 | export const FullPost = () => { 8 | return ( 9 | <> 10 | 25 |

26 | Hey there! 👋 I'm starting a new series called "Roast the Code", where 27 | I will share some code, and let YOU roast and improve it. There's not 28 | much more to it, just be polite and constructive, this is an exercise 29 | so we can all learn together. Now then, head over to the repo and 30 | roast as hard as you can!! 31 |

32 |
33 | 52 | 53 | 54 | 55 | ); 56 | }; 57 | -------------------------------------------------------------------------------- /src/pages/Home.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Tabs from '@mui/material/Tabs'; 3 | import Tab from '@mui/material/Tab'; 4 | import Grid from '@mui/material/Grid'; 5 | 6 | import { Post } from '../components/Post'; 7 | import { TagsBlock } from '../components/TagsBlock'; 8 | import { CommentsBlock } from '../components/CommentsBlock'; 9 | 10 | export const Home = () => { 11 | return ( 12 | <> 13 | 14 | 15 | 16 | 17 | 18 | 19 | {[...Array(5)].map(() => ( 20 | 35 | ))} 36 | 37 | 38 | 39 | 58 | 59 | 60 | 61 | ); 62 | }; 63 | -------------------------------------------------------------------------------- /src/pages/Login/Login.module.scss: -------------------------------------------------------------------------------- 1 | .root { 2 | width: 400px; 3 | padding: 50px; 4 | border: 1px solid #dedede; 5 | margin: 50px auto; 6 | } 7 | 8 | .field { 9 | margin-bottom: 20px !important; 10 | } 11 | 12 | .title { 13 | text-align: center !important; 14 | font-weight: bold !important; 15 | margin-bottom: 30px !important; 16 | } 17 | -------------------------------------------------------------------------------- /src/pages/Login/index.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import Typography from "@mui/material/Typography"; 3 | import TextField from "@mui/material/TextField"; 4 | import Paper from "@mui/material/Paper"; 5 | import Button from "@mui/material/Button"; 6 | 7 | import styles from "./Login.module.scss"; 8 | 9 | export const Login = () => { 10 | return ( 11 | 12 | 13 | Вход в аккаунт 14 | 15 | 22 | 23 | 26 | 27 | ); 28 | }; 29 | -------------------------------------------------------------------------------- /src/pages/Registration/Login.module.scss: -------------------------------------------------------------------------------- 1 | .root { 2 | width: 400px; 3 | padding: 50px; 4 | border: 1px solid #dedede; 5 | margin: 50px auto; 6 | } 7 | 8 | .field { 9 | margin-bottom: 20px !important; 10 | } 11 | 12 | .title { 13 | text-align: center !important; 14 | font-weight: bold !important; 15 | margin-bottom: 30px !important; 16 | } 17 | 18 | .avatar { 19 | display: flex; 20 | justify-content: center; 21 | margin-bottom: 30px; 22 | } 23 | -------------------------------------------------------------------------------- /src/pages/Registration/index.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Typography from '@mui/material/Typography'; 3 | import TextField from '@mui/material/TextField'; 4 | import Paper from '@mui/material/Paper'; 5 | import Button from '@mui/material/Button'; 6 | import Avatar from '@mui/material/Avatar'; 7 | 8 | import styles from './Login.module.scss'; 9 | 10 | export const Registration = () => { 11 | return ( 12 | 13 | 14 | Создание аккаунта 15 | 16 |
17 | 18 |
19 | 20 | 21 | 22 | 25 |
26 | ); 27 | }; 28 | -------------------------------------------------------------------------------- /src/pages/index.js: -------------------------------------------------------------------------------- 1 | export { Home } from "./Home"; 2 | export { FullPost } from "./FullPost"; 3 | export { AddPost } from "./AddPost"; 4 | export { Registration } from "./Registration"; 5 | export { Login } from "./Login"; 6 | -------------------------------------------------------------------------------- /src/theme.js: -------------------------------------------------------------------------------- 1 | import { createTheme } from "@mui/material/styles"; 2 | 3 | export const theme = createTheme({ 4 | shadows: ["none"], 5 | palette: { 6 | primary: { 7 | main: "#4361ee", 8 | }, 9 | }, 10 | typography: { 11 | button: { 12 | textTransform: "none", 13 | fontWeight: 400, 14 | }, 15 | }, 16 | }); 17 | --------------------------------------------------------------------------------