Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Part6 #5

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
1 change: 0 additions & 1 deletion README.md

This file was deleted.

11,442 changes: 11,442 additions & 0 deletions my-app/package-lock.json

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions my-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "my-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.16.1",
"@testing-library/react": "^12.1.2",
"@testing-library/user-event": "^13.5.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "5.0.0",
"web-vitals": "^2.1.2"
},
"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"
]
}
}
42 changes: 42 additions & 0 deletions my-app/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.

Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.

You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.

To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
15 changes: 15 additions & 0 deletions my-app/src/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import classes from "./App.module.css"

import RightPart from "./Components/RightPart/RigthPart"
import LeftPart from "./Components/LeftPart/LeftPart"

function App() {
return (
<div className={classes.App}>
<LeftPart/>
<RightPart/>
</div>
);
}

export default App;
10 changes: 10 additions & 0 deletions my-app/src/App.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.App {
min-width: 60em;
min-height: 35em;
background-color: #444;
border-radius: 30px;
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 2em;
}
Binary file added my-app/src/Assests/img/face.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added my-app/src/Assests/img/git-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added my-app/src/Assests/img/tg-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added my-app/src/Assests/img/vk-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions my-app/src/Components/LeftPart/LeftPart.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React from 'react';
import classes from "./LeftPart.module.css"

import face from "../../Assests/img/face.jpg"
import gitImg from "../../Assests/img/git-logo.png"
import tgImg from "../../Assests/img/tg-logo.png"
import vkImg from "../../Assests/img/vk-logo.png"


import Photo from "../UI/Photo/Photo"
import SocialNetworks from "../SocialNetworks/SocialNetworks"
import MyButton from "../UI/MyButton/MyButton"

const LeftPart = () => {
const networks = [
{id: 1, src: gitImg, href: "https://github.com/coradead"},
{id: 2, src: tgImg, href: "https://tg.com/coradead"},
{id: 3, src: vkImg, href: "https://vk.com/coradead"},
]
return (
<div className={classes.LeftPart}>
<div className={classes.LeftPart_Photo}>
<Photo className={classes.LeftPart_Photo} src={face} height="180px" width="180px"/>
</div>
<div className={classes.LeftPart_FIO}>Alex Smith</div>
<div className={classes.LeftPart_Speciality}>Web Designer</div>
<div className={classes.LeftPart_Networks}>
<SocialNetworks networks={networks}/>
</div>
<div className={classes.LeftPart_MyButton}>
<MyButton>Download</MyButton>
</div>
</div>
);
};

export default LeftPart;
35 changes: 35 additions & 0 deletions my-app/src/Components/LeftPart/LeftPart.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
.LeftPart {
height: 525px;
flex-grow: 2;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
padding-top: 60px;
}

.LeftPart_Photo {
flex-grow: 40;
}

.LeftPart_FIO {
flex-grow: 10;
font-weight: bold;
font-size: 38px;
color: #FFF;
}

.LeftPart_Speciality {
flex-grow: 15;
font-size: 20px;

color: #FFF;
}

.LeftPart_Networks {
flex-grow: 40;
}

.LeftPart_MyButton {
flex-grow: 100;
}
13 changes: 13 additions & 0 deletions my-app/src/Components/RightPart/RightPart.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.RightPart {
min-height: 36.5em;
width: 20em;
flex-grow: 6;
background-color: rgba(34, 34, 34, 1);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
border-radius: 30px;
padding-bottom: 2em;
padding-top: 2em;
}
37 changes: 37 additions & 0 deletions my-app/src/Components/RightPart/RigthPart.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React from 'react';
import classes from "./RightPart.module.css"

import MyButton from "../UI/MyButton/MyButton"
import MyModal from "../UI/MyModal/MyModal"
import SkillList from "../SkillsList/SkillsList"
import SkillForm from "../SkillForm/SkillForm"

const RigthPart = () => {
const [modal, setModal] = React.useState(false)
const [skills, setSkills] = React.useState([
{id: 1, name: "C++", level: "60"}
])

const createSkill = (newSkill) => {
setSkills([...skills, newSkill])
setModal(false)
}

const removeSkill = (skill) => {
setSkills(skills.filter(p => p.id !== skill.id))
}

return (
<div className={classes.RightPart}>
<div className={classes.RightPart_Button}>
<MyButton onClick={() => setModal(true)}>Создать навык</MyButton>
</div>
<SkillList skills={skills} removeSkill={removeSkill}/>
<MyModal visible={modal} setVisible={setModal}>
<SkillForm create={createSkill}/>
</MyModal>
</div>
);
};

export default RigthPart;
4 changes: 4 additions & 0 deletions my-app/src/Components/SkillForm/SkillForm.component.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.SkillForm {
display: flex;
flex-direction: column;
}
40 changes: 40 additions & 0 deletions my-app/src/Components/SkillForm/SkillForm.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import React from 'react';
import classes from "./SkillForm.component.css"

import MyButton from "../UI/MyButton/MyButton"
import MyInput from "../UI/MyInput/MyInput"

const SkillForm = ({create}) => {
const [skill, setSkill] = React.useState({name: '', level: ''})

const addNewSkill = (e) => {
e.preventDefault()
if (skill.level !== '' && skill.name !== '' && skill.level > 0 && skill.level <= 100) {
const newSkill = {
...skill, id: Date.now()
}
create(newSkill)
setSkill({name: '', level: ''})
}
}

return (
<form>
<MyInput
value={skill.name}
onChange={e => setSkill({...skill, name: e.target.value})}
type="text"
placeholder="Название навыка"
/>
<MyInput
value={skill.level}
onChange={e => setSkill({...skill, level: e.target.value})}
type="number"
placeholder="Описание навыка"
/>
<MyButton onClick={addNewSkill}>Создать пост</MyButton>
</form>
);
};

export default SkillForm;
25 changes: 25 additions & 0 deletions my-app/src/Components/SkillsList/SkillDiv/SkillDiv.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react';
import classes from "./SkillDiv.module.css"

import IcnButton from "../../UI/IcnButton/IcnButton"

const SkillDiv = (props) => {
return (
<div className={classes.Skill}>
<div className={classes.Skill_left}>
<div className={classes.Skill_left_name}>{props.skill.name}</div>
<div className={classes.Skill_left_progress}>
<div className={classes.Skill_left_progress_bar} style={{width: props.skill.level + "%"}}/>
</div>
</div>
<div className={classes.Skill_right}>
<IcnButton src="https://freesvg.org/img/1403106653.png"
height="40px"
onClick={() => props.removeSkill(props.skill)}
/>
</div>
</div>
);
};

export default SkillDiv;
55 changes: 55 additions & 0 deletions my-app/src/Components/SkillsList/SkillDiv/SkillDiv.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
.Skill {
display: flex;
flex-direction: row;
align-content: center;
align-items: center;
justify-content: flex-start;
margin-bottom: 1em;
border: transparent 4px;
border-radius: 15px;
height: 5em;
min-width: 400px;
}

.Skill_left {
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: space-evenly;
flex-grow: 6;
height: 100%;
}

.Skill_left_name {
display: flex;
align-items: center;
font-size: 1.5em;
flex-grow: 5;
margin-left: 0.5em;
}

.Skill_left_progress {
box-sizing: border-box;
flex-grow: 1;
width: 100%;
height: 10%;
margin-bottom: 0.3em;
padding: 0.15em;
background-color: transparent;
border: solid 2px darkcyan;
border-radius: 15px;
}

.Skill_left_progress_bar {
margin-top: 0.04em;
width: 60%;
height: 100%;
background: darkcyan;
border-radius: 15px;
}

.Skill_right {
position: relative;
flex-grow: 1;
height: 100%;
}
17 changes: 17 additions & 0 deletions my-app/src/Components/SkillsList/SkillsList.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import classes from "./SkillsList.module.css"

import SkillDiv from "./SkillDiv/SkillDiv"

const SkillsList = ({removeSkill, skills, ...props}) => {
return (
<div className={classes.SkillList}>
{skills.map(
(skillItem, index) =>
<SkillDiv key={skillItem.id} removeSkill={removeSkill} skill={skillItem}/>
)}
</div>
);
};

export default SkillsList;
Loading