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

Develop #6095

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft

Develop #6095

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
29 changes: 29 additions & 0 deletions .github/workflows/test.yml-template
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Test

on:
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
- name: Upload HTML report(backstop data)
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: report
path: backstop_data
9 changes: 5 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@
"keywords": [],
"author": "Mate Academy",
"license": "GPL-3.0",
"dependencies": {},
"devDependencies": {
"@linthtml/linthtml": "^0.9.6",
"@mate-academy/backstop-config": "latest",
"@mate-academy/bemlint": "latest",
"@mate-academy/linthtml-config": "latest",
"@mate-academy/scripts": "^1.8.6",
"@mate-academy/scripts": "^1.9.12",
"@mate-academy/stylelint-config": "latest",
"backstopjs": "6.3.23",
"jest": "^29.7.0",
Expand Down
24 changes: 12 additions & 12 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ The page should match the design Pixel Perfect: all the sizes, colors and distan

## Requirements:

- reset browser default margins
- use [Roboto font](https://fonts.google.com/specimen/Roboto): select ONLY **roman** style, **medium (500)** weight and **normal** width for embedding
- reset browser default margins~~
- use [Roboto font](https://fonts.google.com/specimen/Roboto): select ONLY **roman** style, **medium (500)** weight and **normal** width for embedding~~
- use semantic tags: `<header>`, `<img>`, `<nav>`, `<ul>`, `<li>` and `<a>`
- the header should stretch the full page width (don't use a horizontal margin)
- the height should be set for nav links (not the header), take it from the design
- header content should be vertically centered
- the logo should also be a link with an image inside (from [src/images](src/images)). But it should not be a part of the `<nav>`
- ❗️ the blue link with a line below should have a class `is-active` in addition to any other classes you add
- ❗️ add `data-qa="hover"` attribute to the 4th link for testing (`Laptops & computers`)
- ❗️ add `data-qa="hover"` attribute to the 4th link for testing (`Laptops & computers`)~~
- link color should be changed on `:hover`
- use the `::after` and position it relative to a link with `is-active` class
- don't use the flex `gap` property for indents. It's not supported in tests, use `margin` instead
Expand All @@ -27,15 +27,15 @@ The page should match the design Pixel Perfect: all the sizes, colors and distan

❗️ Replace `<your_account>` with your GitHub username and copy the links to the `Pull Request` description:

- [DEMO LINK](https://<your_account>.github.io/layout_moyo-header/)
- [TEST REPORT LINK](https://<your_account>.github.io/layout_moyo-header/report/html_report/)
- [DEMO LINK](https://disiol.github.io/layout_moyo-header/)
- [TEST REPORT LINK](https://disiol.github.io/layout_moyo-header/report/html_report/)

❗️ Copy this `Checklist` to the `Pull Request` description after links, and put `- [x]` before each point after you checked it.

- [ ] Header height is set in 1 place (for the links)
- [ ] Content is vertically centered (for any header height)
- [ ] CSS is used to show all letters in Uppercase (don't type them in HTML)
- [ ] Logo is an image wrapped with a link
- [ ] **CSS Variable** is used for a blue color
- [ ] Pseudo-element is used for a blue line below the active link
- [ ] Code follows all the [Code Style Rules ❗️](./checklist.md)
- [X] Header height is set in 1 place (for the links)
- [X] Content is vertically centered (for any header height)
- [X] CSS is used to show all letters in Uppercase (don't type them in HTML)
- [X] Logo is an image wrapped with a link
- [X] **CSS Variable** is used for a blue color
- [X] Pseudo-element is used for a blue line below the active link
- [x] Code follows all the [Code Style Rules ❗️](./checklist.md)
112 changes: 105 additions & 7 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,117 @@
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
content="width=device-width, initial-scale=1.0"
/>
<meta
http-equiv="X-UA-Compatible"
content="ie=edge"
<title>Header with Flexbox</title>
<link
rel="stylesheet"
href="style.css"
/>
<title>Moyo header</title>
<link
href="https://fonts.googleapis.com/css2?family=Roboto:wght@500&display=swap"
rel="stylesheet"
href="./style.css"
/>
</head>
<body>
<h1>Moyo header</h1>
<header class="header">
<a
href="/"

Choose a reason for hiding this comment

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

The href attribute for the logo link is set to /, which may not provide meaningful navigation. Consider linking it to the homepage or a relevant section as per the previous review suggestion.

class="header__logo"
>
<img
src="./images/logo.png"
alt="Website Logo"
/>
</a>

<nav class="header__nav-menu nav-menu">
<ul class="nav-menu__list">
<li class="nav-menu__item">
<a
href="#apple"
class="nav-menu__link is-active"
disiol marked this conversation as resolved.
Show resolved Hide resolved
>
Apple
</a>
</li>

<li class="nav-menu__item">
<a
href="#samsung"
class="nav-menu__link"
>
Samsung
</a>
</li>

<li class="nav-menu__item">
<a
href="#smartphones"
class="nav-menu__link"
>
Smartphones
</a>
</li>

<li class="nav-menu__item">
<a
href="#laptops"
class="nav-menu__link"
data-qa="hover"
>
Laptops & Computers
</a>
</li>

<li class="nav-menu__item">
<a
href="#gadgets"
class="nav-menu__link"
>
Gadgets
</a>
</li>

<li class="nav-menu__item">
<a
href="#tablets"
class="nav-menu__link"
>
Tablets
</a>
</li>

<li class="nav-menu__item">
<a
href="#photo"
class="nav-menu__link"
>
Photo
</a>
</li>

<li class="nav-menu__item">
<a
href="#video"
class="nav-menu__link"
>
Video
</a>
</li>
</ul>
</nav>
</header>

<main>
<section id="apple"></section>
<section id="samsung"></section>
<section id="smartphones"></section>
<section id="laptops"></section>
<section id="gadgets"></section>
<section id="tablets"></section>
<section id="photo"></section>
<section id="video"></section>
</main>
</body>
</html>
116 changes: 115 additions & 1 deletion src/style.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,117 @@
:root {
--margin: 0;
--padding: 0;
--box-sizing: border-box;
--accent-color: #00acdc;
--body-bg-color: aliceblue;
--header-bg-color: #fff;
--nav-link-height: 60px;
--logo-size: 40px;
--header-padding: 50px;
}

body,
header,
nav,
ul,
li,
a,
img {
box-sizing: var(--box-sizing);
margin: var(--margin);
padding: var(--padding);
}

body {
margin: 0;
font-family: Roboto, sans-serif;

Choose a reason for hiding this comment

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

Consider adding fallback fonts to the font-family property to ensure proper rendering if 'Roboto' is unavailable. For example, you can use font-family: 'Roboto', Arial, sans-serif;.

background-color: var(--body-bg-color);
margin: var(--margin);
}

.header {
display: flex;
justify-content: space-between;
align-items: center;
padding-inline: var(--header-padding);
width: 100%;
min-height: 60px;
background-color: var(--header-bg-color);
}

.header__logo {
display: block;
width: var(--logo-size);
height: var(--logo-size);
}

.header__logo img {
max-width: 100%;
height: auto;
}

.nav-menu {
margin: var(--margin);
padding: var(--padding);
}

.nav-menu__list {
display: flex;
list-style: none;
}

.nav-menu__item {
display: flex;
align-items: center;
}

.nav-menu__item:not(:last-child) {
margin-right: 20px;
}

.nav-menu__link {
display: flex;
align-items: center;
text-decoration: none;
color: black;
font-weight: 500;
height: var(--nav-link-height);
disiol marked this conversation as resolved.
Show resolved Hide resolved
font-size: 12px;
text-transform: uppercase;
transition: color 0.3s ease;
}

.nav-menu__link:hover {
color: var(--accent-color);
}

.is-active {
position: relative;
color: var(--accent-color);
}

.is-active::after {
content: '';
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 4px;
background-color: var(--accent-color);
border-radius: 8px;
}

html {
scroll-behavior: smooth;
}

@media (max-width: 768px) {
.header {
flex-direction: column;
align-items: center;
}

.nav-menu__list {
flex-direction: column;
gap: 10px;
}
}