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
733 changes: 624 additions & 109 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
97 changes: 12 additions & 85 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,88 +1,15 @@
import React from 'react';
import './App.css';
// Move each BEM block to a separate component (file) and import them here
import Header from './components/Header/Header';
import Navigation from './components/Navigation/Navigation';
Comment on lines +1 to +2
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Duplicate Navigation component exists. There's one in src/components/Header/Navigation.js AND another in src/components/Navigation/Navigation.js. The task requires splitting into components but creates confusion with duplicates.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Inconsistent imports: App.jsx imports Navigation from ./components/Navigation/Navigation while Header.jsx imports from ./Navigation (inside Header folder). Choose one location and use it consistently.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Header imports Navigation from ./Navigation which is inside the Header folder. If Navigation should be a separate component (as implied by App.jsx importing it directly), it shouldn't be nested inside Header.

import Welcome from './components/Welcome/Welcome';
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>
</main>
);
}
const App = () => (
<>
<Header />
<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.

Navigation is rendered twice - once in App.jsx (line 9) and once inside Header.jsx (line 7). Remove one of them. Based on the previous review feedback, remove the <Navigation /> from App.jsx since Navigation is already inside Header.

Comment on lines +8 to +9
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Navigation is rendered inside Header, so it should not also be rendered directly in App.jsx. This is duplicate rendering. Remove line 2 (Navigation import) and line 9 () from App.jsx.

<Welcome />
<Article />
</>
);

export default App;
36 changes: 35 additions & 1 deletion src/components/Article/Article.css
Original file line number Diff line number Diff line change
@@ -1 +1,35 @@
/* Put article styles here */

.article {
margin: 5em auto 0;
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 file contains JSX syntax (like <nav> elements) but has a .js extension. Vite/esbuild cannot parse JSX in .js files, which causes tests to fail. Rename this file to Navigation.jsx.

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;
}
Comment on lines +21 to +34
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The .navigation__link CSS styles (lines 21-34) are placed in Header.css but belong to the Navigation component. Per checklist item #2, each component should have its own styles in its folder. Consider moving these styles to Navigation.css.

Comment on lines +21 to +34
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The .navigation__link styles (lines 21-34) belong to the Navigation component, not Header. Move these CSS rules to src/components/Navigation/Navigation.css and remove them from Header.css to follow the requirement that CSS should be split per component.

Comment on lines +21 to +34
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The .navigation__link styles (lines 21-34) are duplicated in Header.css but Navigation is already its own component with its own CSS file. This CSS should only exist in Navigation.css. The task requires splitting CSS along with JavaScript components.

}
62 changes: 61 additions & 1 deletion src/components/Article/Article.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,65 @@
// import a css file containig article styles
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

There are duplicate Navigation files: src/components/Header/Navigation.js and src/components/Navigation/Navigation.js, plus duplicate CSS files. The files inside Header folder should be removed, and Navigation should only exist in its own folder with consistent imports.


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.

Header.jsx imports Navigation from ./Navigation (same folder), but App.jsx expects Navigation from ./components/Navigation/Navigation. The Navigation component should be in its own folder, not nested inside Header. Move Navigation out of the Header folder to src/components/Navigation/.

// Create an Article function returning the HTML of article block
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 file contains JSX syntax (<nav> elements) but has a .js extension. Vite/esbuild cannot parse JSX in .js files. Rename to .jsx to fix the build error.


// Add a default export statement for Article component to use it in the other files
const Article = () => (
<article className="article">
<h2 className="article__title">Headline</h2>
<p className="article__paragraph">
Comment on lines +8 to +9
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Navigation is imported and rendered inside Header component (line 5 of Header.jsx). Including <Navigation /> directly in App.jsx line 9 will cause Navigation to appear twice on the page. Either remove Navigation from Header.jsx or remove it from App.jsx.

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
Comment on lines +21 to +34
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Navigation CSS styles should not be in Header.css. The .navigation__link styles (lines 21-34) belong to the Navigation component, not the Header. These are duplicated in src/components/Navigation/Navigation.css and should only exist there.

Comment on lines +21 to +34
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 .navigation__link CSS belongs to the Navigation component, not Header. Per [CHECKLIST ITEM #2], each component's CSS should live in its own folder. Move these styles to src/components/Navigation/Navigation.css.

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>
);

export default Article;
48 changes: 47 additions & 1 deletion src/components/Header/Header.css
Original file line number Diff line number Diff line change
@@ -1 +1,47 @@
/* Put header styles here */

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Navigation.js contains JSX syntax (<nav> elements) but has a .js extension. Vite/esbuild cannot parse JSX in .js files. Rename this file to Navigation.jsx.

.header {
width: 100%;
padding: 1em;
font-size: 140%;
position: sticky;
top: 0;
left: 0;
right: 0;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Navigation is rendered twice: here in App.jsx AND inside Header.jsx (which imports and uses Navigation). Remove one of these - either remove <Navigation /> from App.jsx since Header already includes it, OR remove the Navigation import and usage from Header.jsx.

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;
Comment on lines +21 to +34
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 the component decomposition principle. The .navigation__link styles (lines 21-34) are already defined in Navigation.css and should not be duplicated in Header.css. Each component should own only its own styles. Consider removing these navigation-related styles from Header.css.

}
Comment on lines +21 to +35
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 CSS file contains .navigation__link styles (lines 21-34), but Navigation is a separate component with its own folder. According to checklist item #2, each component should have its CSS in its own folder. The navigation styles should only be in src/components/Navigation/Navigation.css.



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


}

13 changes: 13 additions & 0 deletions src/components/Header/Header.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
// import a css file containig header styles
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Navigation.js contains JSX syntax (<nav> elements) but has a .js extension. Vite/esbuild cannot parse JSX in .js files. Rename this file to Navigation.jsx.


import './Header.css';

import Navigation from '../Navigation/Navigation';

// Create a Header function returning the HTML of header block

// Add a default export statement for Header component to use it in the other files
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Navigation is rendered twice: once inside Header component (Header.jsx line 14) and once directly in App.jsx line 9. This will display navigation links twice on the page. Since Navigation is already included inside Header, remove <Navigation /> from App.jsx line 9.


const Header = () => (
<header className="header">
<h1 className="header__title">Site Name</h1>
<Navigation />
</header>
);

Comment on lines 1 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.

Duplicate CSS file: Navigation.css exists in both src/components/Header/ and src/components/Navigation/. Only one copy should remain in the separate Navigation folder.

export default Header;
15 changes: 15 additions & 0 deletions src/components/Navigation/Navigation.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

.navigation__link {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Header.jsx imports Navigation from ./Navigation (inside Header folder) instead of from the Navigation component's own folder. Since App.jsx imports Navigation from ./components/Navigation/Navigation, Header.jsx should import from ../Navigation/Navigation to use the same component.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

After renaming Navigation.js to Navigation.jsx, update this import path to '../Navigation/Navigation' or just '../Navigation/Navigation.jsx' to correctly reference the renamed file.

display: inline-block;
Comment on lines +1 to +3
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 file contains JSX syntax (<nav> elements) but has a .js extension. Vite/esbuild cannot parse JSX in .js files, which causes the error "The JSX syntax extension is not currently enabled". Rename this file to Navigation.jsx.

outline: none;
text-decoration: none;
opacity: 0.7;
padding: 0 0.5em;
color: black;
transition: opacity 0.2s ease-in-out;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Navigation is rendered twice: once directly in App.jsx (line 9) and once inside Header.jsx (line 12). Remove one of them. Since Header already includes Navigation, remove the <Navigation /> and its import from App.jsx.

}

.navigation__link:hover,
.navigation__link:focus {
opacity: 1;
}
17 changes: 17 additions & 0 deletions src/components/Navigation/Navigation.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import './Navigation.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.

Header.jsx imports Navigation from './Navigation' (line 2), but if the file is renamed to .jsx, the import path should be updated to '../Navigation/Navigation' to reference the component in its own folder per CHECKLIST ITEM #2.

const 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.

Navigation.js contains JSX syntax (<nav> elements on lines 3-13) but has a .js extension. Vite/esbuild cannot parse JSX in .js files. This must be renamed to Navigation.jsx.

<nav className="navigation">
<a className="navigation__link" href="#about">
About
</a>
<a className="navigation__link" href="#services">
Services
Comment on lines +8 to +9
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Navigation is rendered twice - once inside Header component (line 14) and once directly in App.jsx (line 9). This will cause Navigation to display twice on the page. Consider removing <Navigation /> from either Header.jsx or App.jsx depending on the intended structure.

</a>
<a className="navigation__link" href="#contact">
Contact
</a>
</nav>
);

export default Navigation;
16 changes: 15 additions & 1 deletion src/components/Welcome/Welcome.css
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
/* Put welcome styles here */

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 file contains JSX syntax (<nav> elements) but has a .js extension. Vite/esbuild cannot parse JSX in .js files, causing tests to fail. Rename this file to Navigation.jsx.

.welcome {
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 import path is wrong. Header.jsx is in src/components/Header/ and Navigation.js is in src/components/Navigation/. The import should be ../Navigation/Navigation instead of ./Navigation.

height: 100vh;
background: coral;
}

.welcome__text {
margin: 0;
font-size: 400%;
Comment on lines +8 to +9
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Navigation is rendered twice: here in App.jsx AND inside Header.jsx (line 12). This causes duplicate Navigation components. Since Header already includes Navigation, remove <Navigation /> from App.jsx (lines 2 and 9).

text-align: center;
line-height: 1;
padding-top: calc(50vh - 20pt);
display: block;
font-weight: 700;
}
9 changes: 9 additions & 0 deletions src/components/Welcome/Welcome.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
// import a css file containig welcome styles
import './Welcome.css';

// Create a Welcome function returning the HTML of welcome block

// Add a default export statement for Welcome component to use it in the other files

const Welcome = () => (
<section className="welcome">
<span className="welcome__text">Sticky Header!</span>
</section>
);

export default Welcome;
Loading