tutorbookapp/tutorbook

View on GitHub
components/user/display.module.scss

Summary

Maintainability
Test Coverage
@use 'styles/sizes';
@use 'styles/common';
@use 'styles/loader';
@use '@material/icon-button';
@use '@material/elevation';

:global(html:not(.dark)) form.picktime {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

form.picktime {
  position: relative;
  border-radius: 8px;
  border: 1px solid var(--accents-2);
  padding: 16px;

  > div {
    min-height: unset;
  }

  button {
    margin-top: 16px;
    width: 100%;
  }
}

.main {
  @include common.wrapper;

  .title {
    justify-content: space-between;
    align-items: flex-end;
    margin: 48px 0 32px;
    display: flex;

    .info {
      flex: 1 1 auto;

      .name {
        font-size: 36px;
        font-weight: 500;
        line-height: 32px;
        height: 32px;
        margin: 0;
      }

      .socials {
        min-height: 20px;
        margin-top: 8px;

        a {
          @include common.link;
          display: inline-block;
          font-size: 14px;
          height: 19px;
        }

        span {
          color: var(--accents-5);
          display: inline-block;
          font-size: 14px;
          height: 19px;

          &.dot {
            font-size: 16px;
            margin: 0 4px;
          }
        }
      }
    }

    .contact {
      text-align: right;

      @media (max-width: 750px) {
        display: none;
      }

      a {
        @include common.link;
        letter-spacing: -0.1px;
        font-size: 16px;
        margin-top: 4px;
        display: block;
      }
    }
  }

  .header {
    display: flex;

    .background {
      flex: 1 1 auto;
      position: relative;
      border-radius: 0 8px 8px 0;
      border: 1px solid var(--accents-2);
      overflow: hidden;
      background: var(--accents-2);
      font-size: 0;

      .backdrop {
        height: 350px;
        width: 642px;
        position: absolute;
        left: 50%;
        top: 50%;
        margin-top: -0.5 * 350px;
        margin-left: -0.5 * 642px;
      }

      .blurred {
        filter: blur(50px);
        transform: scale(110%);
      }
    }

    .avatar {
      flex: none;
      width: 350px;
      height: 350px;
      margin-right: 8px;
      border-radius: 8px 0 0 8px;
      border: 1px solid var(--accents-2);
      position: relative;
      overflow: hidden;
      text-align: center;

      .img {
        border-radius: 0;
      }

      .actions {
        position: absolute;
        bottom: 8px;
        left: 8px;

        button {
          background: var(--primary);
          color: var(--on-primary);
          border-radius: 50%;
          margin: 0 4px;
          height: 32px;
          width: 32px;
          padding: (32px - 18px) / 2;

          svg {
            width: 18px;
            height: 18px;
            display: block;
          }

          &:first-child {
            margin-left: 0;
          }

          &:last-child {
            margin-right: 0;
          }

          @include elevation.elevation(2);
          transition: elevation.transition-value();
          will-change: elevation.$property;

          &:hover,
          &:focus {
            @include elevation.elevation(4);
          }

          &:active {
            @include elevation.elevation(8);
          }

          &:disabled {
            @include elevation.elevation(0);
          }
        }
      }
    }

    @media (max-width: 600px) {
      .background {
        display: none;
      }

      .avatar {
        border-radius: 8px;
        width: 100%;
      }
    }
  }

  .flex {
    display: flex;
    margin: 32px 0 0;

    .content {
      flex: 1 1 auto;
      margin: 0 48px 48px 0;

      dt {
        font-size: 14px;
        font-weight: 500;
        line-height: 16px;
        height: 16px;
        text-transform: uppercase;
        white-space: nowrap;
        color: var(--on-background);
        margin: 0;
      }

      dd {
        font-size: 16px;
        font-weight: 400;
        line-height: 24px;
        letter-spacing: -0.1px;
        color: var(--accents-5);
        margin: 4px 0 24px;

        &:last-child {
          margin-bottom: 0;
        }
      }
    }

    .form {
      flex: none;
      width: 40%;
      margin: 20px 0 48px;

      form {
        position: sticky;
        top: sizes.$header-height + 24px;
      }
    }

    @media (max-width: 750px) {
      flex-direction: column;
      margin-top: 32px;

      .content {
        margin: 0;
      }

      .form {
        margin-top: 32px;
        width: 100%;
      }
    }
  }
}

.loading {
  .name,
  .socials,
  .content dt,
  .content dd,
  .form {
    @include loader.loading;
    border-radius: 4px;
  }

  .header .background {
    @include loader.loading;
    border: none;
  }

  .header .avatar {
    border: none;
  }

  .name {
    max-width: 300px;
  }

  .socials {
    max-width: 250px;
  }

  .content dt {
    max-width: 100px;
  }

  .content dd.bio {
    height: 24px * 5;
  }

  .content dd.subjects {
    max-width: 350px;
    height: 24px;
  }

  .content dd.langs {
    max-width: 200px;
    height: 24px;
  }

  .form {
    border-radius: 8px;
    height: 500px;
  }
}