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

add task solution #4486

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
14 changes: 0 additions & 14 deletions backstop_data/engine_scripts/cookies.json

This file was deleted.

39 changes: 0 additions & 39 deletions backstop_data/engine_scripts/puppet/clickAndHoverHelper.js

This file was deleted.

29 changes: 0 additions & 29 deletions backstop_data/engine_scripts/puppet/loadCookies.js

This file was deleted.

3 changes: 0 additions & 3 deletions backstop_data/engine_scripts/puppet/onBefore.js

This file was deleted.

6 changes: 0 additions & 6 deletions backstop_data/engine_scripts/puppet/onReady.js

This file was deleted.

8 changes: 4 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
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ ___

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

- [DEMO LINK](https://<your_account>.github.io/layout_search-bar-airbnb/)
- [TEST REPORT LINK](https://<your_account>.github.io/layout_search-bar-airbnb/report/html_report/)
- [DEMO LINK](https://RareHelix.github.io/layout_search-bar-airbnb/)
- [TEST REPORT LINK](https://RareHelix.github.io/layout_search-bar-airbnb/report/html_report/)

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

Expand Down
42 changes: 32 additions & 10 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,38 @@
/>
</head>
<body>
<input
type="text"
data-qa="keypress"
placeholder="Try “Los Angeles“"
/>
<div class="search__container">

Choose a reason for hiding this comment

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

Use semantic tags where possible. For example, the search container could be a

or depending on its context within the page.

Choose a reason for hiding this comment

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

Consider adding an empty line before this multiline sibling block for better readability, as per the checklist.

<form
action="/"
method="get"
class="search-bar"
data-qa="big"
Comment on lines +21 to +25

Choose a reason for hiding this comment

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

The attributes of the form tag should start on a new line with 2-space indentation related to the tag, and the tag’s closing bracket should be on the same level as the opening one.

>
<div class="icon">

Choose a reason for hiding this comment

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

Class names should represent the meaning of the content, not the styles or tag names. The class 'icon' could be more descriptive.

<input
type="text"
data-qa="keypress"
placeholder="Try “Los Angeles“"
class="search__input big"
/>

Choose a reason for hiding this comment

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

Remember about correct indentation between parent and child elements. The element inside the

should be indented by 2 spaces.

</div>
</form>

<input
type="text"
data-qa="hover"
placeholder="Try “Los Angeles“"
/>
<form

Choose a reason for hiding this comment

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

Add an empty line before this multiline sibling block to improve readability, according to the checklist.

action="/"
method="get"
class="search-bar"
data-qa="small"
Comment on lines +37 to +41

Choose a reason for hiding this comment

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

The attributes of the form tag should start on a new line with 2-space indentation related to the tag, and the tag’s closing bracket should be on the same level as the opening one.

>
<div class="icon-small">

Choose a reason for hiding this comment

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

Class names should represent the meaning of the content, not the styles or tag names. The class 'icon-small' could be more descriptive.

<input
type="text"
data-qa="hover"
placeholder="Los Angeles"
class="search__input small"
/>

Choose a reason for hiding this comment

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

Remember about correct indentation between parent and child elements. The element inside the

should be indented by 2 spaces.

</div>
</form>
</div>

Choose a reason for hiding this comment

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

Add empty lines between multiline sibling blocks of HTML to improve readability.

</body>
</html>
110 changes: 109 additions & 1 deletion src/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,109 @@
/* add styles here */
@font-face {
font-family: Avenir;
font-weight: 300;
src: url('./fonts/Avenir-Book.ttf') format('truetype');
}

@font-face {
font-family: Avenir;
font-weight: 600;
src: url('./fonts/Avenir-Heavy.ttf') format('truetype');
}

body {
margin: 0;
font-family: Avenir, Arial, sans-serif;
}

Choose a reason for hiding this comment

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

According to the checklist, you should provide a fallback font. Here, you have Arial as a fallback for Avenir, which is good, but it's recommended to include a generic family name as well, like 'sans-serif'.


.search__container {
display: flex;
flex-direction: column;
align-items: stretch;
}

.search__input {
color: #3d4e61;
width: 95%;
padding-left: 45px;
border: 1px solid #e1e7ed;
border-radius: 4px;
font-weight: 300;
transition: border-color 0.3s;
box-shadow: 0 0 7px rgb(232, 230, 230);
font-family: inherit;
position: relative;
margin-left: 10px;
margin-right: 10px;
}

Choose a reason for hiding this comment

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

Be consistent with your margins. You have both left and right margins set on '.search__input'. Consider sticking to either top and bottom or left and right margins for consistency and to avoid potential margin collapse issues.

Choose a reason for hiding this comment

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

The checklist suggests not to fix container sizes. Here, setting both left and right margins on '.search__input' might lead to unexpected behavior when resizing the window or on different screen sizes. Consider using padding within the parent container or setting a max-width instead.


.search__input::placeholder {
color: #3d4e61;
}

.big {
margin-top: 20px;
height: 70px;
font-size: 16px;
}

Choose a reason for hiding this comment

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

The classes '.big' and '.small' are fixing the height of the input fields, which could lead to overflow or accidental scroll bars if the content exceeds the height. Consider using padding and line-height to control the size and let the content dictate the height.


.small {
margin-top: 20px;
height: 42px;
font-size: 14px;
box-shadow: 0 0 7px rgb(229, 228, 228);
text-shadow: 0 3px 4px #bbbec2;
}

Choose a reason for hiding this comment

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

The '.small' class is adding both a margin-top and a box-shadow. Remember that it's recommended to use margins consistently (either top or bottom, but not both) and to not fix container sizes.


.search__input:hover {
border-color: #e1e7ed;
box-shadow: 0 3px 5px rgb(153, 153, 153);
}

.search__input:focus {
background:
linear-gradient(#ffff, #f6f6f7),
url(../src/images/Search.svg) no-repeat 30px;
color: #3d4e61;

Choose a reason for hiding this comment

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

The URL for the background image in the .search-input:focus selector should be relative to the CSS file. If the images folder is on the same level as the src folder, the correct path would be './images/Search.svg'.

font-weight: 600;
font-family: inherit;
outline: none;
}

.icon::before {
/* background: url(../src/images/Search.svg) no-repeat; */
content: url(/src/images/Search.svg);
position: absolute;
top: 55px;
z-index: 10;
transform: translateY(-50%);
left: 25px;
height: 19px;
width: 19px;
}

Choose a reason for hiding this comment

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

Using absolute URLs for content in the '::before' pseudo-element might cause issues if the directory structure changes or when moving the project to a different domain. Consider using relative paths instead.


.icon-small::before {
content: '';
z-index: 10;
background-size: 11px;
width: 11px;
height: 11px;
position: absolute;
top: 135px;
left: 25px;
transform: translateY(-50%);
background-image: url(/src/images/Search.svg);
}

.big:focus {
text-shadow: 0 3px 3px #bbbec2;
}

.small:hover {
box-shadow: 0 3px 5px rgb(206, 206, 206);
text-shadow: none;
}

.small:focus {
box-shadow: none;
text-shadow: none;
}
Loading