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 #4484

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
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://miroshnykow.github.io/layout_search-bar-airbnb/)
- [TEST REPORT LINK](https://miroshnykow.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
38 changes: 27 additions & 11 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,39 @@
http-equiv="X-UA-Compatible"
content="ie=edge"
/>
<title>Document</title>
<title>Search bar</title>
<link
rel="stylesheet"
href="style.css"
/>
</head>
<body>
<input
type="text"
data-qa="keypress"
placeholder="Try “Los Angeles“"
/>
<form
action="#"
data-qa="big"
>
Comment on lines +21 to +24

Choose a reason for hiding this comment

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

Keep your attributes correctly formatted. If the element has more than 2 attributes, start each one on a new line with a 2-space indentation related to the tag.

<label>
<input

Choose a reason for hiding this comment

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

Consider using a div or section element to wrap the input field inside the label for better semantics and style targeting.

class="search-bar search-bar__big"

Choose a reason for hiding this comment

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

The type attribute value 'text' should be on the same line as the class attribute, following the rule that if an element has more than two attributes, each one, including the first, should start on a new line with 2-space indentation.

type="text"

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 name 'search-bar__big' suggests a BEM naming convention but is being used to indicate the size. Consider a more meaningful name that describes the purpose or context instead of the size.

data-qa="keypress"
placeholder="Try “Los Angeles“"

Choose a reason for hiding this comment

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

The input element's attributes should be formatted according to the guidelines. Each attribute should start on a new line with a 2-space indentation.

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 search-bar__big could be misinterpreted as a style rather than the meaning of the content.

/>
</label>
</form>

<input
type="text"
data-qa="hover"
placeholder="Try “Los Angeles“"
/>
<form
action="#"
data-qa="small"
>
Comment on lines +42 to +45

Choose a reason for hiding this comment

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

Keep your attributes correctly formatted. If the element has more than 2 attributes, start each one on a new line with a 2-space indentation related to the tag.

<label>
<input

Choose a reason for hiding this comment

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

The type attribute value 'text' should be on the same line as the class attribute for consistency with the formatting rule for multiple attributes.

class="search-bar search-bar__small"

Choose a reason for hiding this comment

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

Similar to the previous comment, 'search-bar__small' should be replaced with a class name that reflects the function or context of the element rather than its size.

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

Choose a reason for hiding this comment

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

There should be empty lines between sibling form blocks to simplify reading and add some "air" to the code structure.

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

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

.search-bar {
font-family: Avenir, sans-serif;
display: block;

Choose a reason for hiding this comment

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

Consider adding a fallback font family after 'Avenir'. If 'Avenir' fails to load for some reason, the browser will use the fallback font instead.

Choose a reason for hiding this comment

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

Consider adding a fallback font-family for Avenir in case it fails to load. For example, 'font-family: Avenir, Arial, sans-serif;'. This ensures text is still readable with a default font.

box-sizing: border-box;
width: 100%;

margin-top: 20px;
border: 1px solid #e1e7ed;

Choose a reason for hiding this comment

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

According to the checklist, be consistent with your margins. Choose either top or bottom margins for elements, but not both, 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.

According to the checklist, be consistent with your margins. It's recommended to add margins only to the top or bottom of elements, not both, to avoid potential margin collapse.

Choose a reason for hiding this comment

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

The .search-bar class has a fixed margin-top, which might not be flexible for different contexts. Consider using a more responsive design approach unless a fixed size is a specific requirement.

border-radius: 4px;
box-shadow: 0 1px 8px 0 #3d4e611a;
color: #3d4e61;
}

.search-bar::placeholder {
color: #3d4e61;
}

.search-bar__big {
height: 70px;
background-image: url(images/Search.svg);
background-repeat: no-repeat;
background-size: 19px 19px;
font-size: 16px;
padding-left: 62px;
background-position: 26px center;
background-color: #ffff;
}

.search-bar__big:hover {
box-shadow: 0 3px 8px 0 #3d4e6133;
}

.search-bar__big:focus {
border: 1px solid #e1e7ed;
box-shadow: 0 4px 4px 0 rgba(0, 0, 0, 0.25);

background-image: url('./images/Search.svg'),
linear-gradient(180deg, transparent, #f6f6f7);

background-repeat: no-repeat;
background-position: 26px 25px;
background-size: 19px 19px;
text-shadow: 0 4px 4px rgba(0, 0, 0, 0.25);
font-weight: bold;
}

.search-bar__small {
height: 42px;
background-image: url(images/Search.svg);
background-repeat: no-repeat;
background-size: 11px 11px;
font-size: 14px;
font-weight: 400;
padding-left: 33px;
background-position: 13px center;
}

.search-bar__small:hover {
box-shadow: 0 3px 8px 0 #3d4e61;
text-shadow: none;
}

.search-bar__small:focus {
border: 1px solid #e1e7ed;
text-shadow: none;
background-image: url(/src/images/Search.svg),
linear-gradient(180deg, transparent, #f6f6f7);

Choose a reason for hiding this comment

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

Make sure the path to the image is consistent across the CSS file. Here, the path starts with '/src/images/Search.svg', while elsewhere it is 'images/Search.svg'. Use a consistent path to ensure the image loads correctly in all cases.


background-repeat: no-repeat;
background-position: 13px center;
background-size: 11px 11px;
}
Loading