Chocobozzz/PeerTube

View on GitHub
client/src/app/menu/notification-dropdown.component.scss

Summary

Maintainability
Test Coverage
@use '_variables' as *;
@use '_mixins' as *;

.content {
  scrollbar-color: auto;
}

.notification-inbox-dropdown {
  padding: 10px;
}

.notification-inbox-link a {
  padding: 13px 10px;
}

.notification-inbox-dropdown,
.notification-inbox-link a {
  transition: all .1s ease-in-out;
  border-radius: 25px;
  cursor: pointer;

  @include apply-svg-color(#808080);

  ::ng-deep svg {
    transition: color .1s ease-in-out;
  }

  &:hover,
  &:active {
    background-color: rgba(255, 255, 255, 0.15);

    @include apply-svg-color(#fff);
  }
}

.notification-inbox-dropdown.shown,
.notification-inbox-link a.active {
  background-color: rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 3px 5px rgba(0, 0, 0, .325);

  @include apply-svg-color(#fff);
}

.notification-inbox-dropdown.hidden {
  display: none;
}

::ng-deep {
  .dropdown-notifications {
    max-width: none;
    top: -6px !important;
    left: 7px !important;

    .dropdown-menu {
      padding: 0;
      font-size: 14px;
      font-family: $main-fonts;
      width: 400px;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);

      .loader {
        display: flex;
        align-items: center;
        justify-content: center;

        padding: 5px 0;
      }

      .content {
        max-height: 150px;
        transition: max-height 0.15s ease-out;
        display: flex;
        height: 500px;
        flex-direction: column;

        &.loaded {
          max-height: 500px;
        }

        > my-user-notifications:nth-child(2) {
          overflow-y: auto;
          flex-grow: 1;
        }
      }

      .notifications-header {
        display: flex;
        justify-content: space-between;

        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        align-items: center;
        padding: 0 12px;
        font-size: 14px;
        font-weight: bold;
        color: rgba(0, 0, 0, 0.5);
        text-transform: uppercase;
        min-height: 40px;

        a {
          @include disable-default-a-behaviour;
        }

        button {
          padding: 0;
          background: transparent;

          @include peertube-button;
        }

        a,
        button {
          color: rgba(20, 20, 20, 0.5);

          &:hover:not(:disabled) {
            color: rgba(20, 20, 20, 0.8);
          }
        }

        my-global-icon[iconName=cog] {
          width: 20px;
        }

        my-global-icon[iconName=tick] {
          width: 26px;
        }
      }

      .all-notifications {
        border-top: 1px solid rgba(0, 0, 0, 0.1);
        margin-top: -1px; // To not have 2 borders with the last notification
        text-align: center;
        font-weight: $font-semibold;
        color: pvar(--mainForegroundColor);
        padding: 0.75rem 0;
        text-decoration: underline !important;

        &:hover {
          opacity: 0.85;
        }
      }
    }
  }
}

.notification-inbox-dropdown,
.notification-inbox-link {
  cursor: pointer;
  position: relative;

  .unread-notifications {
    @include margin-left(20px);
  }

  .unread-notifications {
    position: absolute;
    top: 6px;
    left: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    background-color: pvar(--mainColor);
    color: #fff;
    font-size: 10px;
    font-weight: $font-semibold;

    border-radius: 15px;
    width: 15px;
    height: 15px;

    @media screen and (max-width: $mobile-view) {
      top: -4px;
      left: -2px;
    }
  }
}