HabitatMap/AirCasting

View on GitHub
app/assets/stylesheets/modules/session-card.scss

Summary

Maintainability
Test Coverage
@mixin session-card-halo($color) {
  box-shadow: 0px 0px 6px 2px rgba($color, 1);
}

.session-card {
  background: white;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: $lighter-shadow;
  margin: $margin-default 0 5px $margin-default;
  min-width: 220px;
  padding: $margin-default;
  position: relative;

  &:last-child {
    margin-right: $margin-default;
  }

  &::before {
    content: " ";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    border-radius: 12px;
    opacity: 0;
    transition: opacity 300ms;
    @include session-card-halo($grey);
  }

  &.level1-bg::before {
    @include session-card-halo(var(--level1-colour));
  }

  &.level2-bg::before {
    @include session-card-halo(var(--level2-colour));
  }

  &.level3-bg::before {
    @include session-card-halo(var(--level3-colour));
  }

  &.level4-bg::before {
    @include session-card-halo(var(--level4-colour));
  }

  &:hover::before {
    opacity: 1;
  }
}

.session-card__color {
  height: 12px;
  width: 12px;
  border-radius: 12px;
  margin-right: 10px;
  margin-top: 5px;
  float: left;
}

.session-card__name {
  font-size: 16px;
  font-weight: $font-stack-regular;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-card__owner {
  font-size: $small-font;
  margin: 2px 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-card__dates {
  font-size: $tiny-font;
  margin-right: 3px;
}