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

search-bar ver 1.0.0 #4409

Open
wants to merge 4 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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@mate-academy/backstop-config": "latest",
"@mate-academy/bemlint": "latest",
"@mate-academy/linthtml-config": "latest",
"@mate-academy/scripts": "^1.7.3",
"@mate-academy/scripts": "^1.8.1",
"@mate-academy/stylelint-config": "latest",
"backstopjs": "6.2.2",
"jest": "^29.7.0",
Expand Down
36 changes: 26 additions & 10 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,32 @@
/>
</head>
<body>
<input
type="text"
data-qa="keypress"
placeholder="Try “Los Angeles“"
/>
<form class="search">
<div
class="search search-bar_big"

Choose a reason for hiding this comment

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

you don't need divs inside forms (remember to move data-qa to form)

data-qa="big"
>
<input
type="text"
class="search-bar_big__form"

Choose a reason for hiding this comment

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

try to simplify class name

data-qa="keypress"
placeholder="Try “Los Angeles“"
/>
</div>
</form>

<input
type="text"
data-qa="hover"
placeholder="Try “Los Angeles“"
/>
<form class="search">
<div
class="search search-bar_small"
data-qa="small"
>
<input
type="text"
class="search-bar_small__form"
data-qa="hover"
placeholder="Try “Los Angeles“"
/>
</div>
</form>
</body>
</html>
126 changes: 125 additions & 1 deletion src/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,125 @@
/* add styles here */
@font-face {
font-family: Avenir;
src: url(./fonts/Avenir-Book.ttf);
font-weight: 300;
}

.search {
margin-top: 20px;
position: relative;
}

.search-bar_big {
height: 68px;

Choose a reason for hiding this comment

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

total height should be 70px so you need to include border (box-sizing: border-box) and change style to 70px
same for small search
image

display: flex;
position: relative;

border: 1px solid rgba(225, 231, 237, 1);
box-shadow: 0 1px 8px 0 #3d4e611a;
border-radius: 4px;
}

.search-bar_big:hover {
box-shadow: 0 3px 8px 0 rgba(61, 78, 97, 0.2);
}

.search-bar_big::after {
background-image: url('./images/Search.svg');
background-position: center;
background-repeat: no-repeat;
background-size: contain;
content: '';
position: absolute;
height: 19px;
Comment on lines +17 to +22
Copy link

Choose a reason for hiding this comment

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

Those styles also are reapeated.

width: 19px;
top: 24px;
left: 25px;
}

.search-bar_big__form {
position: relative;
left: 60px;
line-height: 21px;

border: none;

font-family: Avenir, sans-serif;
font-size: 16px;
}

.search-bar_big__form:focus {
margin-top: 25px;
max-height: 22px;

box-shadow: 0 4px 4px 0 rgba(0, 0, 0, 0.25);
background: linear-gradient(180deg, #fff 0%, #f6f6f7 100%);

font-weight: bold;
}

Choose a reason for hiding this comment

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

on focus:

  • there shouldn't be any border
    image
  • when you start typing the entire input moves down slightly
  • input should be the size of search bar because now you add e.g background gradient only for this small fragment
    image

.search-bar_big__form:placeholder-shown {
max-height: 22px;
margin-top: 21px;
}

Choose a reason for hiding this comment

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

try to center it so it works regardless of search bar height

.search-bar-big__form::placeholder {
font-size: 25px;
}

input.search-bar_big__form {
font-weight: 500;
margin-bottom: 2px;
}

Choose a reason for hiding this comment

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

you don't need this

.search-bar_small {
height: 40px;
margin-top: 8px;

display: flex;
position: relative;

border: 1px solid rgba(225, 231, 237, 1);
border-radius: 4px;
box-shadow: 0 1px 8px 0 #3d4e611a;
}

.search-bar_small:hover {
box-shadow: 0 3px 8px 0 rgba(61, 78, 97, 0.2);
}

.search-bar_small::after {
background-image: url('./images/Search.svg');
background-position: center;
background-repeat: no-repeat;
background-size: contain;
content: '';
width: 11px;
height: 11px;
position: absolute;
top: 14px;
left: 12px;
}

.search-bar_small__form {
position: relative;
left: 31px;
line-height: 19px;
border: none;
font-family: Avenir, sans-serif;
font-size: 14px;
}

.search-bar_small__form:focus {
margin-top: 8px;
max-height: 22px;

box-shadow: 0 4px 4px 0 rgba(0, 0, 0, 0.25);
background: linear-gradient(180deg, #fff 0%, #f6f6f7 100%);
font-weight: bold;
}

input.search-bar_small__form {
font-weight: 500;
margin-bottom: 2px;
}
Loading