diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 0000000..d5f574d --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,7 @@ +module.exports = { + trailingComma: 'es5', + tabWidth: 4, + semi: false, + singleQuote: true, + endOfLine: 'auto', +} diff --git a/package.json b/package.json index 6db149e..4b9b8ae 100644 --- a/package.json +++ b/package.json @@ -1,56 +1,57 @@ { - "name": "home-works", - "homepage": "https://IgnatZakalinsky.github.io/home-works", - "version": "0.1.0", - "private": true, - "dependencies": { - "@emotion/react": "^11.9.3", - "@emotion/styled": "^11.9.3", - "@mui/material": "^5.8.4", - "@testing-library/jest-dom": "^5.14.1", - "@testing-library/react": "^13.0.0", - "@testing-library/user-event": "^13.2.1", - "@types/jest": "^27.0.1", - "@types/node": "^16.7.13", - "@types/react": "^18.0.0", - "@types/react-dom": "^18.0.0", - "@types/uuid": "^8.3.4", - "axios": "^0.27.2", - "gh-pages": "^4.0.0", - "react": "^18.1.0", - "react-dom": "^18.1.0", - "react-redux": "^8.0.2", - "react-router-dom": "^6.3.0", - "react-scripts": "5.0.1", - "redux": "^4.2.0", - "typescript": "^4.4.2", - "uuid": "^8.3.2", - "web-vitals": "^2.1.0" - }, - "scripts": { - "start": "react-scripts start", - "build": "react-scripts build", - "test": "react-scripts test", - "eject": "react-scripts eject", - "predeploy": "npm run build", - "deploy": "gh-pages -d build" - }, - "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" - ] - } + "name": "home-works", + "homepage": "https://IgnatZakalinsky.github.io/home-works", + "version": "0.1.0", + "private": true, + "dependencies": { + "@emotion/react": "^11.9.3", + "@emotion/styled": "^11.9.3", + "@mui/material": "^5.8.4", + "@testing-library/jest-dom": "^5.14.1", + "@testing-library/react": "^13.0.0", + "@testing-library/user-event": "^13.2.1", + "@types/jest": "^27.0.1", + "@types/node": "^16.7.13", + "@types/react": "^18.0.0", + "@types/react-dom": "^18.0.0", + "@types/uuid": "^8.3.4", + "axios": "^0.27.2", + "gh-pages": "^4.0.0", + "prettier": "^2.7.1", + "react": "^18.1.0", + "react-dom": "^18.1.0", + "react-redux": "^8.0.2", + "react-router-dom": "^6.3.0", + "react-scripts": "5.0.1", + "redux": "^4.2.0", + "typescript": "^4.4.2", + "uuid": "^8.3.2", + "web-vitals": "^2.1.0" + }, + "scripts": { + "start": "react-scripts start", + "build": "react-scripts build", + "test": "react-scripts test", + "eject": "react-scripts eject", + "predeploy": "npm run build", + "deploy": "gh-pages -d build" + }, + "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" + ] + } } diff --git a/public/index.html b/public/index.html index bc15ee7..3bedd49 100644 --- a/public/index.html +++ b/public/index.html @@ -1,21 +1,21 @@ - - - - - - - - - - - React App - - - -
- - + --> diff --git a/public/manifest.json b/public/manifest.json index 080d6c7..f01493f 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -1,25 +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" + "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/src/index.css b/src/index.css index fe5e20d..14abadb 100644 --- a/src/index.css +++ b/src/index.css @@ -7,17 +7,16 @@ body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', - 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', - 'Helvetica Neue', sans-serif; + 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', + 'Helvetica Neue', sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; box-sizing: border-box; - } code { font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', - monospace; + monospace; } [data-theme='1'] { @@ -68,7 +67,6 @@ code { --success: #16a34a; --warning: #d97706; --error: #dc2626; - } html { diff --git a/src/index.tsx b/src/index.tsx index 610ca37..1f2ac6e 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -3,16 +3,14 @@ import ReactDOM from 'react-dom/client' import './index.css' import App from './s1-main/App' import reportWebVitals from './reportWebVitals' -import {Provider} from 'react-redux' +import { Provider } from 'react-redux' import store from './s2-homeworks/hw10/bll/store' -const root = ReactDOM.createRoot( - document.getElementById('root') as HTMLElement -) +const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement) root.render( - + ) diff --git a/src/reportWebVitals.ts b/src/reportWebVitals.ts index 49a2a16..3984df9 100644 --- a/src/reportWebVitals.ts +++ b/src/reportWebVitals.ts @@ -1,15 +1,17 @@ -import { ReportHandler } from 'web-vitals'; +import { ReportHandler } from 'web-vitals' const reportWebVitals = (onPerfEntry?: ReportHandler) => { - if (onPerfEntry && onPerfEntry instanceof Function) { - import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { - getCLS(onPerfEntry); - getFID(onPerfEntry); - getFCP(onPerfEntry); - getLCP(onPerfEntry); - getTTFB(onPerfEntry); - }); - } -}; + if (onPerfEntry && onPerfEntry instanceof Function) { + import('web-vitals').then( + ({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { + getCLS(onPerfEntry) + getFID(onPerfEntry) + getFCP(onPerfEntry) + getLCP(onPerfEntry) + getTTFB(onPerfEntry) + } + ) + } +} -export default reportWebVitals; +export default reportWebVitals diff --git a/src/s1-main/App.module.css b/src/s1-main/App.module.css index a672827..d64c0de 100644 --- a/src/s1-main/App.module.css +++ b/src/s1-main/App.module.css @@ -3,7 +3,6 @@ } .hw { - } .hwTitle { @@ -25,5 +24,5 @@ hr { border-top: 1px solid #d9d9d9; - margin: 0 -} \ No newline at end of file + margin: 0; +} diff --git a/src/s1-main/App.tsx b/src/s1-main/App.tsx index 5d2671c..83cfec7 100644 --- a/src/s1-main/App.tsx +++ b/src/s1-main/App.tsx @@ -25,7 +25,7 @@ const App = () => { {/**/} {/**/} - + ) } diff --git a/src/s2-homeworks/hw01/FriendMessage.tsx b/src/s2-homeworks/hw01/FriendMessage.tsx index c301cb1..9ae30b3 100644 --- a/src/s2-homeworks/hw01/FriendMessage.tsx +++ b/src/s2-homeworks/hw01/FriendMessage.tsx @@ -4,38 +4,48 @@ import s from './Message.module.css' // создать тип вместо any и отобразить приходящие данные const FriendMessage = (props: any) => { return ( -
+
{'avatar'}
-
+
{/*создаёт студент*/} {props.message.user.name} {/**/}
-
+
{/*создаёт студент*/} {props.message.message.text} {/**/}
-
-
+
{/*создаёт студент*/} {props.message.message.time} {/**/}
- ) } diff --git a/src/s2-homeworks/hw01/HW1.tsx b/src/s2-homeworks/hw01/HW1.tsx index 24b2f27..0e073e0 100644 --- a/src/s2-homeworks/hw01/HW1.tsx +++ b/src/s2-homeworks/hw01/HW1.tsx @@ -32,7 +32,6 @@ export const friendMessage0: MessageType = { }, } - const HW1 = () => { return (
@@ -40,21 +39,20 @@ const HW1 = () => { {/*можно убрать этот тег*/}
Homework #1
-
+
{/*проверка отображения (не менять)*/}
- + {/*не обязательно*/} - +
{/*для автоматической проверки дз (не менять)*/} - +
- {/*
*/} {/*можно убрать этот тег*/}
diff --git a/src/s2-homeworks/hw01/Message.module.css b/src/s2-homeworks/hw01/Message.module.css index b299352..7accfea 100644 --- a/src/s2-homeworks/hw01/Message.module.css +++ b/src/s2-homeworks/hw01/Message.module.css @@ -63,7 +63,8 @@ max-width: 70%; height: 100%; background-color: #06c; - box-shadow: 0 5px 20px rgba(29, 33, 38, 0.03), 0 1px 2px rgba(29, 33, 38, 0.1); + box-shadow: 0 5px 20px rgba(29, 33, 38, 0.03), + 0 1px 2px rgba(29, 33, 38, 0.1); display: flex; flex-direction: column; margin-right: 20px; @@ -119,7 +120,8 @@ .textarea { box-sizing: border-box; background: #f5f7fb; - box-shadow: 0 5px 20px rgba(29, 33, 38, 0.03), 0 1px 2px rgba(29, 33, 38, 0.1); + box-shadow: 0 5px 20px rgba(29, 33, 38, 0.03), + 0 1px 2px rgba(29, 33, 38, 0.1); border-radius: 20px; width: 100%; border: none; @@ -173,4 +175,3 @@ img { width: 48px; text-align: center; } - diff --git a/src/s2-homeworks/hw01/Message.tsx b/src/s2-homeworks/hw01/Message.tsx index aa46568..c9e019d 100644 --- a/src/s2-homeworks/hw01/Message.tsx +++ b/src/s2-homeworks/hw01/Message.tsx @@ -11,7 +11,6 @@ const Message = (props: MessagePropsType) => {
{'avatar'} { {/**/}
- ) } diff --git a/src/s2-homeworks/hw01/MessageSender.tsx b/src/s2-homeworks/hw01/MessageSender.tsx index 26df1ff..5d6c2b6 100644 --- a/src/s2-homeworks/hw01/MessageSender.tsx +++ b/src/s2-homeworks/hw01/MessageSender.tsx @@ -9,33 +9,44 @@ const MessageSender = (props: any) => { const [text, setText] = useState('') const addMessage = () => { - setMessages([...messages, { - id: messages.length ? messages.length + 1 : 1, - user: message0.user, - message: { - text, - time: new Date().toTimeString().slice(0, 5), + setMessages([ + ...messages, + { + id: messages.length ? messages.length + 1 : 1, + user: message0.user, + message: { + text, + time: new Date().toTimeString().slice(0, 5), + }, }, - }]) + ]) setTimeout(() => setText(''), 4) } return ( <> - {messages.map(m => )} + {messages.map((m) => ( + + ))}