From 20174eb9183a208442e25ca8ed3dd91550201133 Mon Sep 17 00:00:00 2001 From: Denys Date: Wed, 22 Jan 2025 14:51:10 +0200 Subject: [PATCH] add solution --- package-lock.json | 9 +-- package.json | 2 +- src/App.css | 88 +----------------------------- src/App.jsx | 82 ++-------------------------- src/components/Article/Article.css | 31 ++++++++++- src/components/Article/Article.jsx | 67 ++++++++++++++++++++++- src/components/Header/Header.css | 44 ++++++++++++++- src/components/Header/Header.jsx | 23 +++++++- src/components/Welcome/Welcome.css | 15 ++++- src/components/Welcome/Welcome.jsx | 12 +++- 10 files changed, 193 insertions(+), 180 deletions(-) diff --git a/package-lock.json b/package-lock.json index 199392962..f87a843a4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ }, "devDependencies": { "@cypress/react18": "^2.0.1", - "@mate-academy/scripts": "^1.8.5", + "@mate-academy/scripts": "^1.9.12", "@mate-academy/stylelint-config": "*", "@vitejs/plugin-react": "^4.3.1", "cypress": "^13.13.0", @@ -763,10 +763,11 @@ } }, "node_modules/@mate-academy/scripts": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/@mate-academy/scripts/-/scripts-1.8.5.tgz", - "integrity": "sha512-mHRY2FkuoYCf5U0ahIukkaRo5LSZsxrTSgMJheFoyf3VXsTvfM9OfWcZIDIDB521kdPrScHHnRp+JRNjCfUO5A==", + "version": "1.9.12", + "resolved": "https://registry.npmjs.org/@mate-academy/scripts/-/scripts-1.9.12.tgz", + "integrity": "sha512-/OcmxMa34lYLFlGx7Ig926W1U1qjrnXbjFJ2TzUcDaLmED+A5se652NcWwGOidXRuMAOYLPU2jNYBEkKyXrFJA==", "dev": true, + "license": "MIT", "dependencies": { "@octokit/rest": "^17.11.2", "@types/get-port": "^4.2.0", diff --git a/package.json b/package.json index 4084d88ef..46e96889a 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ }, "devDependencies": { "@cypress/react18": "^2.0.1", - "@mate-academy/scripts": "^1.8.5", + "@mate-academy/scripts": "^1.9.12", "@mate-academy/stylelint-config": "*", "@vitejs/plugin-react": "^4.3.1", "cypress": "^13.13.0", diff --git a/src/App.css b/src/App.css index cfaa88809..a2a25b029 100644 --- a/src/App.css +++ b/src/App.css @@ -1,3 +1,4 @@ + iframe { display: none; } @@ -17,90 +18,3 @@ body { margin: 0; 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; - display: flex; - justify-content: space-between; - } - - .article { - margin: 3.5em auto 0; - padding: 2em; - } -} - -@media (min-width: 800px) { - .article { - margin: 3.5em auto; - } -} diff --git a/src/App.jsx b/src/App.jsx index c97808216..52f9a5b74 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,86 +1,16 @@ import React from 'react'; import './App.css'; +import Header from './components/Header/Header'; +import Welcome from './components/Welcome/Welcome'; +import Article from './components/Article/Article'; // Move each BEM block to a separate component (file) and import them here function App() { return (
-
- Sticky Header! -
-
-

Site Name

- -
-
-

Headline

-

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

-

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

-

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

-

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

-

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

-
+ +
+
); } diff --git a/src/components/Article/Article.css b/src/components/Article/Article.css index 56e2e0542..ab0b59343 100644 --- a/src/components/Article/Article.css +++ b/src/components/Article/Article.css @@ -1 +1,30 @@ -/* Put article styles here */ +.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) { + .article { + margin: 3.5em auto 0; + padding: 2em; + } +} + +@media (min-width: 800px) { + .article { + margin: 3.5em auto; + } +} diff --git a/src/components/Article/Article.jsx b/src/components/Article/Article.jsx index 073476529..176a67eaa 100644 --- a/src/components/Article/Article.jsx +++ b/src/components/Article/Article.jsx @@ -1,5 +1,66 @@ -// import a css file containig article styles +import './Article.css'; -// Create an Article function returning the HTML of article block +function Article() { + return ( +
+

Headline

+

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

+

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

+

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

+

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

+

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

+
+ ); +} -// Add a default export statement for Article component to use it in the other files +export default Article; diff --git a/src/components/Header/Header.css b/src/components/Header/Header.css index 0b160f66f..a943d24f2 100644 --- a/src/components/Header/Header.css +++ b/src/components/Header/Header.css @@ -1 +1,43 @@ -/* 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; +} + +.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; +} + +@media (min-width: 500px) { + .header { + text-align: left; + display: flex; + justify-content: space-between; + } +} + diff --git a/src/components/Header/Header.jsx b/src/components/Header/Header.jsx index 3f2fea103..a3bbc9f29 100644 --- a/src/components/Header/Header.jsx +++ b/src/components/Header/Header.jsx @@ -1,5 +1,22 @@ -// import a css file containig header styles +import './Header.css'; -// Create a Header function returning the HTML of header block +function Header() { + return ( +
+

Site Name

+ +
+ ); +} -// Add a default export statement for Header component to use it in the other files +export default Header; diff --git a/src/components/Welcome/Welcome.css b/src/components/Welcome/Welcome.css index 564ff918a..af6498e91 100644 --- a/src/components/Welcome/Welcome.css +++ b/src/components/Welcome/Welcome.css @@ -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); + display: block; + font-weight: 700; +} diff --git a/src/components/Welcome/Welcome.jsx b/src/components/Welcome/Welcome.jsx index fbaaa3c4d..b7aa70a12 100644 --- a/src/components/Welcome/Welcome.jsx +++ b/src/components/Welcome/Welcome.jsx @@ -1,5 +1,11 @@ -// import a css file containig welcome styles +import './Welcome.css'; -// Create a Welcome function returning the HTML of welcome block +function Welcome() { + return ( +
+ Sticky Header! +
+ ); +} -// Add a default export statement for Welcome component to use it in the other files +export default Welcome;