Skip to content

Commit

Permalink
LayoutSearchBarAirbnb
Browse files Browse the repository at this point in the history
  • Loading branch information
ITguy-star committed Feb 15, 2025
1 parent f3f70fa commit 5afc99b
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 129 deletions.
42 changes: 22 additions & 20 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,30 @@
href="style.css"
/>
</head>
<body class="page">
<body>
<form
class="search"
action="/search"
method="get"
action="#"
class="search-form search-form--big"
data-qa="big"
>
<div class="search__bar search__bar--big">
<input
type="text"
data-qa="big"
placeholder="Try “Los Angeles“"
class="search__input"
/>
</div>
<div class="search__bar search__bar--small">
<input
type="text"
data-qa="small"
placeholder="Try “Los Angeles“"
class="search__input"
/>
</div>
<input
type="text"
class="search-form__input search-form__input--big"
data-qa="keypress"
placeholder="Try “Los Angeles“"
/>
</form>

<form
action="#"
class="search-form search-form--small"
data-qa="small"
>
<input
type="text"
class="search-form__input search-form__input--small"
placeholder="Try “Los Angeles“"
/>
</form>
</body>
</html>
155 changes: 46 additions & 109 deletions src/style.css
Original file line number Diff line number Diff line change
@@ -1,144 +1,81 @@
/* #region font import */
/* #region Fonts */
@font-face {
font-family: Avenir;
src: url('./fonts/Avenir-Book.ttf') format('truetype');
font-family: 'Avenir Book';
src: url(./fonts/Avenir-Book.ttf);
font-weight: 300;
font-style: normal;
}

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

/* #endregion */

:root {
--searchbar-height-small: 42px;
--searchbar-height-big: 70px;
--font-size-small: 14px;
--font-size-big: 16px;
--icon-size-small: 11px;
--icon-size-big: 19px;
--input-pad-x-small: 13px;
--input-padding-x-big: 26px;
--icon-shift-left-big: 26px;
--icon-mar-r-small: 9px;
--icon-mar-r-big: 17px;
--focus-background-fade-all: linear-gradient(180deg, #fff 0%, #f6f6f7 100%);
--shadow-big: 0 4px 4px 0 #00000040;
--text-color: #3d4e61;
}

.page {
font-family: Avenir, sans-serif;
font-weight: 300;
font-style: normal;
color: #3d4e61;
}

.search__bar {
position: relative;
}

/* #region pseudoelement icon */
.search__bar::before {
content: '';
position: absolute;
left: var(--input-pad-x-small);
top: 48%;
transform: translateY(-50%);
width: var(--icon-size-small);
height: var(--icon-size-small);
background-image: url('./images/Search.svg');
background-repeat: no-repeat;
background-size: contain;
pointer-events: none;
}
/* #region Base Styles */

.search__bar--big.search__bar::before {
background-size: var(--icon-size-big) var(--icon-size-big);
left: var(--input-padding-x-big);
width: var(--icon-size-big);
height: var(--icon-size-big);
.search-form {
margin-top: 20px;
}

/* #endregion */

.search__input {
display: block;
height: var(--searchbar-height-small);
.search-form__input {
width: 100%;
padding-left: calc(
var(--input-pad-x-small) + var(--icon-size-small) + var(--icon-mar-r-small)
);
padding-right: var(--input-pad-x-small);

box-sizing: border-box;
border: 1px solid #e1e7ed;
box-shadow: 0 1px 8px #3d4e611a;
border-radius: 4px;

box-shadow: 0 1px 8px 0 #3d4e611a;
outline: none;

font-family: 'Avenir Book', Arial, sans-serif;
font-weight: 300;
font-family: inherit;
font-size: var(--font-size-small);
color: #3d4e61;
box-sizing: border-box;
}

.search__input::placeholder {
color: var(--text-color);
.search-form__input::placeholder {
color: #3d4e61;
}

/* #region default */
.search__bar--small .search__input {
text-shadow: var(--shadow-big);
/* States */
.search-form__input:hover {
box-shadow: 0 3px 8px #3d4e6133;
}

.search__bar--big .search__input {
padding-left: calc(
var(--input-padding-x-big) + var(--icon-size-big) + var(--icon-mar-r-big)
);
padding-right: var(--input-padding-x-big);
height: var(--searchbar-height-big);

font-size: var(--font-size-big);
line-height: 22px;
.search-form__input:focus {
font-family: 'Avenir Heavy', Arial, sans-serif;
font-weight: 700;
outline: none;
text-shadow: 0 4px 4px #00000040;
}

/* #endregion */

/* #region hover */
.search__bar--small .search__input:hover {
box-shadow: 0 3px 8px #3d4e6133;
text-shadow: none;
}
/* #region Modifiers */

.search__bar--big .search__input:hover {
box-shadow: var(--shadow-big);
/* Big Form */
.search-form--big {
margin-top: 20px;
}

/* #endregion */

/* #region focus */
.search__bar--small .search__input:focus {
background: var(--focus-background-fade-all);
text-shadow: none;
font-weight: 900;
.search-form__input--big {
height: 70px;
padding-left: 62px;
background: url(images/Search.svg) no-repeat 26px 25px;
background-size: 18px 18px;
font-size: 16px;
line-height: 22px;
}

.search__bar--big .search__input:focus {
background: var(--focus-background-fade-all);
box-shadow: var(--shadow-big);
/* Small Form */
.search-form--small {
margin-top: 20px;
}

font-weight: 900;
text-shadow: var(--shadow-big);
.search-form__input--small {
height: 42px;
padding-left: 33px;
background: url(images/Search.svg) no-repeat 13px 15px;
background-size: 10px 10px;
font-size: 14px;
line-height: 20px;
}

/* #endregion */

.search__bar:first-of-type {
margin-block: 20px;
}

0 comments on commit 5afc99b

Please sign in to comment.