Skip to content

Instantly share code, notes, and snippets.

@peterkarn
Created February 5, 2022 21:37
Show Gist options
  • Save peterkarn/61e6c826818f8d96a8f0d3122b04bde3 to your computer and use it in GitHub Desktop.
Save peterkarn/61e6c826818f8d96a8f0d3122b04bde3 to your computer and use it in GitHub Desktop.
@mixin font($font_name, $file_name, $weight, $style) {
@font-face {
font-family: $font_name;
font-weight: #{$weight};
font-style: #{$style};
font-display: swap;
src: url('../fonts/#{$file_name}.woff2') format('woff2');
}
}
@import 'fonts';
@import 'normalize';
@import 'variables';
@import 'global';
@import 'header';
.offer {
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
min-height: 400px;
padding: 70px 20px;
text-align: center;
color: var(--light);
background: url(../img/hero-bg-desktop.jpg) center / cover no-repeat;
@media screen and (max-width: $xsmall) {
background-image: url(../img/hero-bg-mobile.jpg);
}
}
.offer__suptitle {
font-size: 17px;
margin-bottom: 20px;
}
.offer__title {
@include adaptiv-value('font-size', 60, 35, 1);
@include adaptiv-value('margin-bottom', 40, 15, 1);
}
.offer__subtitle {
font-size: 17px;
max-width: 680px;
}
.filters {
position: relative;
padding: 20px 0;
border-top: 1px solid transparent;
border-bottom: 1px solid var(--primary-fade);
background-color: var(--light);
.container {
display: grid;
grid-template-columns: repeat(2, max-content);
gap: 20px;
@media screen and (max-width: $small) {
grid-template-columns: auto;
}
}
&__btn {
position: relative;
padding: 12px 16px 12px 40px;
color: var(--dark);
border: 1px solid transparent;
border-radius: var(--radius);
background-color: #f5f6fd;
&:hover {
color: var(--light);
}
&:active {
border: 1px solid var(--light);
}
}
&__btn_dates::before {
content: '';
position: absolute;
top: 13px;
left: 10px;
display: block;
width: 16px;
height: 16px;
background-image: url('../img/icons/calendar.svg');
background-repeat: no-repeat;
}
&__btn_guests::before {
content: '';
position: absolute;
top: 13px;
left: 10px;
display: block;
width: 16px;
height: 16px;
background-image: url('../img/icons/human.svg');
background-repeat: no-repeat;
}
}
// hotels
.hotels {
@include adaptiv-value('padding-top', 60, 30, 1);
@include adaptiv-value('padding-bottom', 60, 30, 1);
&__list {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(370px, 1fr));
gap: 40px 20px;
}
}
.card {
display: flex;
font-size: 17px;
flex-direction: column;
height: 100%;
&__img {
position: relative;
display: block;
margin-bottom: 16px;
padding-bottom: 65%;
&:before,
&:after {
content: '';
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
transition: transform .2s;
transform: scale(.8);
border-radius: var(--radius);
}
&:before {
opacity: .7;
background-color: #1f35d4;
box-shadow: 0 0 0 5px #7180e4;
}
&:after {
z-index: -1;
opacity: .5;
background-color: #4558db;
box-shadow: 0 0 0 5px #a7b0ee;
}
img {
transition: transform .2s;
border-radius: var(--radius);
}
&:hover {
img {
transform: scale(.95);
}
&:after {
transform: scale(1.01) rotate(3deg);
}
&:before {
transform: scale(1.03) rotate(-2deg);
}
}
}
&__city {
margin-bottom: 5px;
color: var(--primary);
}
&__title {
font-size: 22px;
font-weight: 600;
margin-bottom: 5px;
}
&__description {
display: -webkit-box;
line-height: 2;
overflow: hidden;
-webkit-box-orient: vertical;
margin-bottom: 10px;
-webkit-line-clamp: 6;
}
&__price {
font-weight: 600;
margin-top: auto;
}
a:hover {
text-decoration: underline;
}
}
.sticky {
.filters,
.header {
position: sticky;
z-index: 1;
top: 0;
right: 0;
left: 0;
}
.filters {
transition: opacity .5s;
transform: translateY(100%);
animation: fadeIn 1s ease;
box-shadow: 0 7px 7px 0 rgba(0, 0, 0, .2);
border-top-color: var(--primary-fade);
@media screen and (max-width: $medium) {
top: 80px;
transform: none;
}
}
.header {
animation: fadeIn 1s ease;
background-color: var(--light);
}
.burger {
color: var(--dark);
}
}
.dis-scroll {
overflow: hidden;
.filters {
@media screen and (max-width: $medium) {
display: none;
}
}
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment