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 3 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
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
32 changes: 22 additions & 10 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,28 @@
/>
</head>
<body>
<input
type="text"
data-qa="keypress"
placeholder="Try “Los Angeles“"
/>
<form
class="search search_big"
data-qa="big"
>
<input
type="text"
class="search__input_big"
data-qa="keypress"
placeholder="Try &#x0022;Los Angeles&#x0022;"
/>
</form>

<input
type="text"
data-qa="hover"
placeholder="Try “Los Angeles“"
/>
<form
class="search search__small"
data-qa="small"
>
<input
type="text"
class="search__input_small"
data-qa="hover"
placeholder="Try &#x0022;Los Angeles&#x0022;"
/>
</form>
</body>
</html>
107 changes: 106 additions & 1 deletion src/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,106 @@
/* add styles here */
@font-face {
font-family: Avenir;
src: url(./fonts/Avenir-Book.ttf);
font-weight: 300;
color: rgba(61, 78, 97, 1);
}

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

.search_big {
height: 70px;
Copy link

Choose a reason for hiding this comment

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

That's supposed to be modifier - .search--big


display: flex;
position: relative;
box-sizing: border-box;
}
Comment on lines +11 to +13
Copy link

Choose a reason for hiding this comment

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

You also use those styles in .search__small. You can move it to the .search selector. Keep your code DRY


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

.search_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: 25px;
left: 26px;
}

.search__input_big {
padding-left: 62px;
height: 100%;
width: 100%;
line-height: 21px;
outline: none;
box-sizing: border-box;
border: 1px solid rgba(225, 231, 237, 1);
border-radius: 4px;
box-shadow: 0 1px 8px 0 rgba(61, 78, 97, 0.1);

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

Copy link

Choose a reason for hiding this comment

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

You can also create element .search__input and then use modifier ...--big and ..--small. This way you can remove repeated code.

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

font-weight: bold;
}

Comment on lines +65 to +70
Copy link

Choose a reason for hiding this comment

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

You forgot to delete this one.

.search__small {
height: 42px;
margin-top: 20px;

display: flex;
position: relative;
box-sizing: border-box;
}

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

Copy link

Choose a reason for hiding this comment

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

Its the same as for .search_big:hover

.search__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: 15px;
left: 13px;
}

.search__input_small {
padding-left: 33px;
height: 100%;
width: 100%;
line-height: 19px;
outline: none;
box-sizing: border-box;
border: 1px solid rgba(225, 231, 237, 1);
border-radius: 4px;
box-shadow: 0 1px 8px 0 rgba(61, 78, 97, 0.1);

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

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

font-weight: bold;
}
Loading