Files
advanced-css/Trillo/starter/sass/_components.scss
T
2024-06-03 17:35:36 +02:00

296 lines
5.1 KiB
SCSS

// Logo
.logo {
height: 3.25rem;
margin-left: 2rem;
}
// Search
.search {
display: flex;
align-items: center;
justify-content: center;
flex: 0 0 40%;
&__input {
font-family: inherit;
font-size: inherit;
color: inherit;
border: none;
background-color: var(--color-grey-light-2);
padding: 0.7rem 2rem;
border-radius: 100px;
width: 90%;
transition: all 0.2s;
margin-right: -3.25rem;
&:focus {
outline: none;
width: 100%;
background-color: var(--color-grey-light-3);
}
&::placeholder,
&::-webkit-input-placeholder {
font-weight: 100;
color: var(--color-grey-light-4);
}
}
&__input:focus + &__button {
background-color: var(--color-grey-light-3);
}
&__button {
border: none;
background-color: var(--color-grey-light-2);
&:focus {
outline: none;
}
&:active {
transform: translateY(2px);
}
}
&__icon {
height: 2rem;
width: 2rem;
fill: var(--color-grey-dark-3);
}
}
// User nav
.user-nav {
display: flex;
align-items: center;
align-self: stretch; //NOTE: make it cover the entire height
& > * {
height: 100%;
padding: 0 2rem;
cursor: pointer;
display: flex;
align-items: center;
}
& > *:hover {
background-color: var(--color-grey-light-2);
}
&__icon-box {
position: relative;
}
&__icon {
height: 2.25rem;
width: 2.25rem;
fill: var(--color-grey-dark-3);
}
&__notification {
font-size: 0.8rem;
height: 1.75rem;
width: 1.75rem;
border-radius: 50%;
background-color: var(--color-primary);
color: white;
position: absolute;
top: 1.5rem;
right: 1.1rem;
display: flex;
justify-content: center;
align-items: center;
}
&__user-photo {
height: 3.75rem;
border-radius: 50%;
margin-right: 1rem;
}
}
// Side navigation
.side-nav {
font-size: 1.4rem;
list-style: none;
margin-top: 3.5rem;
&__item {
position: relative;
&:not(:last-child) {
margin-bottom: 0.5rem;
}
}
&__item::before {
content: "";
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 3px;
background-color: var(--color-primary);
transform: scaleY(0);
transform-origin: center; //NOTE: cool
transition:
transform 0.2s,
width 0.4s cubic-bezier(1, 0, 0, 1) 0.2s,
//NOTE: duration timing delay
background-color 0.1s;
}
&__item:hover::before,
&__item--active::before {
transform: scaleY(1);
width: 100%;
}
&__item:active::before {
background-color: var(--color-primary-light);
}
&__link:link,
&__link:visited {
color: var(--color-grey-light-1);
text-decoration: none;
text-transform: uppercase;
display: flex;
align-items: center;
padding: 1.5rem 3rem;
position: relative;
z-index: 10;
}
&__icon {
width: 1.75rem;
height: 1.75rem;
margin-right: 2rem;
fill: currentColor; //NOTE: color of current or parent element
}
}
// Legal
.legal {
font-size: 1.2rem;
color: var(--color-grey-light-4);
text-align: center;
padding: 2.5rem;
}
// Gallery
.gallery {
display: flex;
&__photo {
width: 100%;
display: block;
}
}
// Overview
.overview {
display: flex;
align-items: center;
border-bottom: 1px solid var(--color-grey-light-2);
&__heading {
font-size: 2.25rem;
font-weight: 300;
text-transform: uppercase;
letter-spacing: 1px;
padding: 1.5rem 3rem;
}
&__stars {
margin-right: auto; // NOTE: to imitate flex: 1 effect but with a small final box, instead of one that extends all the space
display: flex; // NOTE: because svg behave like inline so is either this or set line-height: 0 and font-size: 0;
}
&__icon-star,
&__icon-location {
width: 1.75rem;
height: 1.75rem;
fill: var(--color-primary);
}
&__location {
font-size: 1.2rem;
display: flex;
vertical-align: center;
}
&__icon-location {
margin-right: 0.5rem;
}
&__rating {
background-color: var(--color-primary);
color: white;
margin-left: 3rem;
padding: 0 2.25rem;
align-self: stretch;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
&__rating-average {
font-size: 2.25rem;
font-weight: 300;
margin-bottom: -3px;
}
&__rating-count {
font-weight: 0.8rem;
text-transform: uppercase;
}
}
// btn
.btn-inline {
border: none;
color: var(--color-primary);
font-size: inherit; // NOTE: to make it more reusable
border-bottom: 1px solid currentColor;
padding-bottom: 2px;
display: inline-block;
background-color: transparent;
cursor: pointer;
transition: all 0.2s;
&:hover {
color: var(--color-grey-dark-1);
}
&:focus {
outline: none;
animation: pulsate 1s infinite;
}
}
@keyframes pulsate {
0% {
transform: scale(1); // NOTE: needs an initial value in order to animate
box-shadow: none;
}
50% {
transform: scale(1.05);
box-shadow: 0 1rem 4rem rgba(0, 0, 0, 0.25);
}
100% {
transform: scale(1);
box-shadow: none;
}
}