Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ Split the `App.js` into components based on CSS blocks. CSS code should be split
- Install Prettier Extention and use this [VSCode settings](https://mate-academy.github.io/fe-program/tools/vscode/settings.json) to enable format on save.
- Implement a solution following the [React task guideline](https://github.com/mate-academy/react_task-guideline#react-tasks-guideline)
- Open one more terminal and run tests with `npm test` to ensure your solutions is correct
- Replace `<your_account>` with your Github username in the [DEMO LINK](https://<your_account>.github.io/react_decompose/) and add it to the PR description
- Replace `<your_account>` with your Github username in the [DEMO LINK](https://aamaltseva-sqwosh.github.io/react_decompose/) and add it to the PR description
7,871 changes: 4,442 additions & 3,429 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"devDependencies": {
"@cypress/react18": "^2.0.1",
"@mate-academy/scripts": "^1.8.5",
"@mate-academy/scripts": "^2.1.3",
"@mate-academy/stylelint-config": "*",
"@vitejs/plugin-react": "^4.3.1",
"cypress": "^13.13.0",
Expand Down
68 changes: 0 additions & 68 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,74 +18,6 @@ body {
background: #eee;
}

.welcome {
height: 100vh;
background: coral;
}

.welcome__text {
margin: 0;
font-size: 400%;
text-align: center;
line-height: 1;
padding-top: calc(50vh - 20pt);
display: block;
font-weight: 700;
}

.header {
width: 100%;
padding: 1em;
font-size: 140%;
position: sticky;
top: 0;
left: 0;
right: 0;
transition: opacity 0.2s ease-in-out;
text-align: center;
}

.header__title {
font-weight: 600;
display: inline;
margin: 0;
padding: 0;
font-size: inherit;
}

.navigation__link {
display: inline-block;
outline: none;
text-decoration: none;
opacity: 0.7;
padding: 0 0.5em;
color: black;
transition: opacity 0.2s ease-in-out;
}

.navigation__link:hover,
.navigation__link:focus {
opacity: 1;
}

.article {
margin: 5em auto 0;
padding: 1em;
font-size: 140%;
max-width: 800px;
background: white;
box-shadow: rgba(0, 0, 0, 0.05) 0 3px 15px;
}

.article__paragraph {
margin: 0;
color: #333;
}

.article__paragraph:not(:first-child) {
margin-top: 0.7em;
}

@media (min-width: 500px) {
.header {
text-align: left;
Expand Down
85 changes: 8 additions & 77 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,86 +1,17 @@
import React from 'react';

import './App.css';
// Move each BEM block to a separate component (file) and import them here

import Welcome from './components/Welcome/Welcome';
import Header from './components/Header/Header';
import Article from './components/Article/Article';

function App() {
return (
<main className="app">
<section className="welcome">
<span className="welcome__text">Sticky Header!</span>
</section>
<header className="header">
<h1 className="header__title">Site Name</h1>
<nav className="navigation">
<a className="navigation__link" href="#about">
About
</a>
<a className="navigation__link" href="#services">
Services
</a>
<a className="navigation__link" href="#contact">
Contact
</a>
</nav>
</header>
<article className="article">
<h2 className="article__title">Headline</h2>
<p className="article__paragraph">
In elementum lorem eget est euismod ornare. Phasellus sit amet
pellentesque mauris. Aliquam quis malesuada ex. Nullam eu aliquam
nibh. Mauris molestie, urna accumsan ornare semper, augue nibh posuere
lorem, vitae feugiat sem magna eget massa. Vivamus quis tincidunt
dolor. Fusce efficitur, orci non vestibulum consequat, lectus turpis
bibendum odio, in efficitur leo felis sed justo. Fusce commodo iaculis
orci, quis imperdiet urna. Sed mollis facilisis lacus non condimentum.
Nunc efficitur massa non neque elementum semper. Vestibulum lorem
arcu, tincidunt in quam et, feugiat venenatis augue. Donec sed
tincidunt tellus, a facilisis magna. Proin sit amet viverra nibh,
bibendum gravida felis. Vivamus ut nunc id mauris posuere
pellentesque. Praesent tincidunt id odio id feugiat.
</p>
<p className="article__paragraph">
In ac nisi lacus. Fusce est dolor, tincidunt ut bibendum vitae,
fermentum ac quam. Aliquam pretium tristique nibh quis iaculis. In et
cursus ex, eu aliquet ex. Proin facilisis lacus sit amet sapien
ultrices, ut vehicula arcu lobortis. Vivamus mollis ipsum ut hendrerit
molestie. Morbi lacinia, sapien eu dictum dignissim, tellus tortor
congue magna, sit amet bibendum libero nisi id massa.
</p>
<p className="article__paragraph">
Donec arcu elit, euismod vel lobortis eu, fringilla sit amet dolor.
Cras congue, massa nec sagittis mollis, dui felis ultrices magna,
tincidunt finibus lorem quam in sem. Morbi odio turpis, pulvinar sit
amet vulputate quis, ultricies eu libero. Donec ac maximus neque, nec
maximus nibh. Morbi rhoncus convallis urna, accumsan porta lorem
hendrerit in. Cras eget nisl dui. Morbi faucibus nisi eget ipsum
semper vulputate. Mauris nec tincidunt lectus. Aenean ac mi consequat
velit dignissim consectetur. Fusce placerat ac ipsum ac eleifend.
Aenean quis faucibus ex.
</p>
<p className="article__paragraph">
Cras egestas tempor nibh, a fermentum lorem sollicitudin non. Nulla
facilisi. In at elit id leo tristique condimentum. Donec at est nulla.
Mauris egestas magna ut laoreet pretium. Sed ultrices suscipit
vestibulum. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Fusce id sapien eros. Vivamus viverra ultricies gravida. Nam urna
nibh, blandit a vulputate at, vehicula non nulla. Aenean ut nulla leo.
Praesent in ullamcorper est.
</p>
<p className="article__paragraph">
Pellentesque habitant morbi tristique senectus et netus et malesuada
fames ac turpis egestas. Phasellus bibendum nec arcu eu lobortis. Nam
convallis faucibus ante sed porta. Nullam ut convallis elit, quis
venenatis nunc. Curabitur sed sem eget velit condimentum rutrum in et
orci. Nunc non suscipit eros. Suspendisse porta sem vel justo commodo
dictum. Aliquam erat ligula, fringilla nec suscipit sed, porta vitae
turpis. Vestibulum rhoncus placerat nulla vitae suscipit. Curabitur
consectetur ex ut odio tristique vehicula. Ut ligula tortor, tincidunt
quis sodales vitae, ornare a turpis. Proin sit amet finibus enim.
Fusce tempus a neque vitae tempor. Aenean rutrum, libero iaculis
interdum vulputate, dui eros vehicula nisi, at interdum enim lacus eu
diam.
</p>
</article>
<Welcome />
<Header />
<Article />
</main>
);
}
Expand Down
31 changes: 30 additions & 1 deletion src/components/Article/Article.css
Original file line number Diff line number Diff line change
@@ -1 +1,30 @@
/* Put article styles here */
.article {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing src/components/Header/Header.jsx file - the task requires using the existing Header folder and splitting CSS from components based on CSS blocks

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing src/components/Navigation/Navigation.jsx and Navigation.css files - the task explicitly requires creating a Navigation folder and moving navigation there

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing src/components/Welcome/Welcome.jsx and Welcome.css files - the task requires using the existing Welcome folder

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing src/App.css - the task requires splitting CSS code too, and the original App.css contains base styles that should be handled appropriately

margin: 5em auto 0;
padding: 1em;
font-size: 140%;
max-width: 800px;
background: white;
box-shadow: rgba(0, 0, 0, 0.05) 0 3px 15px;
}

.article__paragraph {
margin: 0;
color: #333;
}

.article__paragraph:not(:first-child) {
margin-top: 0.7em;
}

@media (min-width: 500px) {
.article {
margin: 3.5em auto 0;
padding: 2em;
}
}

@media (min-width: 800px) {
.article {
margin: 3.5em auto;
}
}
32 changes: 29 additions & 3 deletions src/components/Article/Article.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
// import a css file containig article styles
import React from 'react';

// Create an Article function returning the HTML of article block
import './Article.css';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing Navigation.css file - referenced by the import in Navigation.jsx


// Add a default export statement for Article component to use it in the other files
function Article() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing Welcome.jsx and Welcome.css files - App.jsx imports Welcome but these files don't exist

return (

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing Navigation.jsx file - Header.jsx imports Navigation but this file doesn't exist in the provided code

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing Header.jsx file - the component is imported in App.jsx but the file wasn't provided

<article className="article">
<h2 className="article__title">Headline</h2>

<p className="article__paragraph">
In elementum lorem eget est euismod ornare...
</p>
Comment on lines +8 to +12

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates checklist item #1: excessive blank lines between JSX elements inside the article component


<p className="article__paragraph">In ac nisi lacus. Fusce est dolor...</p>
Comment on lines +13 to +14

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates checklist item #1: excessive blank lines between JSX elements inside the article component


<p className="article__paragraph">
Donec arcu elit, euismod vel lobortis eu...
Comment on lines +15 to +17

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates checklist item #1: excessive blank lines between JSX elements inside the article component

</p>

<p className="article__paragraph">
Cras egestas tempor nibh, a fermentum lorem...
</p>
Comment on lines +18 to +22

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates checklist item #1: excessive blank lines between JSX elements inside the article component


<p className="article__paragraph">
Pellentesque habitant morbi tristique senectus...
</p>
Comment on lines +23 to +26

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates checklist item #1: excessive blank lines between JSX elements inside the article component

</article>
);
}

export default Article;
29 changes: 28 additions & 1 deletion src/components/Header/Header.css
Original file line number Diff line number Diff line change
@@ -1 +1,28 @@
/* Put header styles here */
.header {
width: 100%;
padding: 1em;
font-size: 140%;
position: sticky;
top: 0;
left: 0;
right: 0;
transition: opacity 0.2s ease-in-out;
text-align: center;
}

.header__title {
font-weight: 600;
display: inline;
margin: 0;
padding: 0;
font-size: inherit;
}

@media (min-width: 500px) {
.header {
text-align: left;
display: flex;
justify-content: space-between;
}
}

18 changes: 15 additions & 3 deletions src/components/Header/Header.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
// import a css file containig header styles
import React from 'react';

// Create a Header function returning the HTML of header block
import './Header.css';

// Add a default export statement for Header component to use it in the other files
import Navigation from '../Navigation/Navigation';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing Welcome.jsx file - App.jsx imports this component but the JSX file doesn't exist in the Welcome folder


function Header() {
return (
<header className="header">
<h1 className="header__title">Site Name</h1>

<Navigation />
Comment on lines +10 to +12

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checklist item #1 violation: excessive blank lines between components inside JSX

</header>
);
}

export default Header;
Comment on lines +10 to +17

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checklist item #1 violation: excessive blank lines between JSX elements inside nav

14 changes: 14 additions & 0 deletions src/components/Navigation/Navigation.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.navigation__link {
display: inline-block;
outline: none;
text-decoration: none;
opacity: 0.7;
padding: 0 0.5em;
color: black;
transition: opacity 0.2s ease-in-out;
}

.navigation__link:hover,
.navigation__link:focus {
opacity: 1;
}
23 changes: 23 additions & 0 deletions src/components/Navigation/Navigation.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';

import './Navigation.css';

function Navigation() {
return (
<nav className="navigation">
<a className="navigation__link" href="#about">
About
</a>

<a className="navigation__link" href="#services">
Comment on lines +8 to +12

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates checklist item #1: excessive blank lines between JSX elements (lines 8, 13, 15, 18, 23 contain empty lines between <p> tags). Compare to GOOD example - components should be placed directly without multiple blank lines between them.

Services
</a>

<a className="navigation__link" href="#contact">
Comment on lines +2 to +16

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates checklist item #1: excessive blank lines between JSX elements (lines 2, 4, 6, 11, 16 contain empty lines). The JSX children should flow directly after each other.

Contact
</a>
</nav>
);
}

Comment on lines +2 to +22

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates checklist item #1: excessive blank lines between JSX elements (lines 2, 4, 11, 15, 22 contain empty lines). Remove these blank lines to follow the GOOD example pattern.

export default Navigation;
15 changes: 14 additions & 1 deletion src/components/Welcome/Welcome.css
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
/* Put welcome styles here */
.welcome {
height: 100vh;
background: coral;
}

.welcome__text {
margin: 0;
font-size: 400%;
text-align: center;
line-height: 1;
padding-top: calc(50vh - 20pt);
Comment on lines +10 to +11

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates checklist item #1: There's an unnecessary blank line between the h1 and Navigation component inside the header element

display: block;
font-weight: 700;
}
Comment on lines +10 to +14

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates checklist item #1: Excessive blank line between link elements inside the nav

14 changes: 11 additions & 3 deletions src/components/Welcome/Welcome.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
// import a css file containig welcome styles
import React from 'react';

// Create a Welcome function returning the HTML of welcome block
import './Welcome.css';

// Add a default export statement for Welcome component to use it in the other files
function Welcome() {
return (
<section className="welcome">
<span className="welcome__text">Sticky Header!</span>
Comment on lines 2 to +8

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checklist item #1 violation: excessive empty lines between imports and component definition (lines 2, 4)

Comment on lines 2 to +8

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checklist item #1 violation: excessive empty lines between imports and component definition (lines 2, 4)

</section>
);
Comment on lines 2 to +10

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checklist item #1 violation: excessive empty lines between imports and component definition (lines 2, 4)

}

Comment on lines +10 to +12

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checklist item #1 violation: excessive empty line between h1 and Navigation inside header JSX

export default Welcome;
Loading