온라인 강의/Advanced CSS and Sass [Udemy]

80. Building the Hotel Overview - Part 1

유호야 2023. 8. 3. 20:28
반응형

 

넓은 공간이 필요한 게 아니라면 img 는 block 또는 inline-block 이어야 한다.

 

margin auto의 놀라운 기능

별 이모티콘에 auto를 줬을 뿐인데 오른쪽의 공간을 넓직하게 만들었다

  &__stars {
    // flex: 1;
    margin-right: auto;
    background-color: red;
  }

 


_components.scss

////////////////////////////////////////////////
/// LOGO

.logo {
  height: 3.25rem;
  margin-left: 2rem;
}

////////////////////////////////////////////////
/// SEARCH
.search {
  flex: 0 0 40%;
  display: flex;
  align-items: center;
  justify-content: center;

  &__input {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    background-color: var(--color-grey-light-2);
    border: none;
    padding: 0.7rem 2rem;
    border-radius: 100px;
    width: 80%;
    transition: all 0.7s;
    margin-right: -3.5rem;

    &:focus {
      outline: none;
      width: 100%;
      background-color: var(--color-grey-light-3);
    }

    &::-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 NAVIGATION
.user-nav {
  display: flex;
  align-items: center;
  align-self: stretch;

  & > * {
    padding: 0 2rem;
    cursor: pointer;
    transition: all 0.3s;
    height: 100%;

    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-2);
  }

  &__notification {
    font-size: 0.8rem;
    height: 1.75rem;
    width: 1.75rem;
    border-radius: 50%;
    background-color: var(--color-primary);
    color: #fff;

    position: absolute;
    top: 1.5rem;
    right: 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);
    transition: transform 0.2s, width 0.3s 0.2s cubic-bezier(1, 0, 0, 1),
      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: block;
    padding: 1.5rem 3rem;

    display: flex;
    align-items: center;

    position: relative;
    z-index: 10;
  }

  &__icon {
    width: 1.75rem;
    height: 1.75rem;
    margin-right: 1rem;
    // fill: var(--color-grey-light-3);
    fill: currentColor;
  }
}

/// ////////////////////////////////////////////////
/// LEGAL TEXT
.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;
  }
}

/// ////////////////////////////////////////////////
/// HOTEL OVERVIEW
.overview {
  display: flex;
  justify-content: space-between;

  font-size: 4.2rem;
  font-weight: 200;

  &__heading {
    text-transform: uppercase;
  }

  &__stars {
    margin-right: auto;
  }

  &__icon-star,
  &__icon-location {
    width: 1.75rem;
    height: 1.75rem;
    fill: var(--color-primary);
  }

  &__location {
    span {
      font-size: 1.5rem;
      text-decoration: underline;
      transition: all 0.4s;
      cursor: pointer;
      display: inline-block;

      &:hover {
        color: var(--color-primary);
        transform: scale(1.1);
      }
    }
  }

  &__rating {
  }

  &__rating-average {
  }

  &__rating-count {
  }
}
반응형