CartoDB/cartodb20

View on GitHub
app/assets/stylesheets/editor-3/_widget-list.scss

Summary

Maintainability
Test Coverage
@import 'cdb-variables/colors';
@import 'cdb-variables/sizes';

@mixin fakeBorder() {
  content: '';
  display: block;
  position: absolute;
  top: -1px;
  right: -1px;
  bottom: -1px;
  left: -1px;
  width: calc(100% - 2px);
  height: calc(100% - 2px);
  border: 1px solid $cSecondaryLine;
  border-radius: 4px;
  pointer-events: none;
}

.WidgetList {
  display: flex;
  flex-wrap: wrap;
}

.WidgetList-option {
  margin-right: 16px;
}

.WidgetList-item {
  display: flex;
  position: relative;
  box-sizing: border-box;
  flex: 0 0 304px;
  align-items: baseline;
  width: 304px;
  max-width: 304px;
  margin: 0 4px 8px;
  padding: $baseSize * 2;
  transition: border 200ms ease-in;
  border: 1px solid $cMainLine;
  border-radius: $baseSize / 2;
  background: $cWhite;
  cursor: pointer;

  &:hover {
    transition: border 200ms ease-in;

    &::after {
      @include fakeBorder();
      border: 2px solid $cBlueHover;
    }
  }

  &.is-hover {
    &:hover {
      &::after {
        display: none;
      }
    }
  }

  &.is-selected {
    &::after {
      @include fakeBorder();
      border: 2px solid $cMainText;
    }

    &:hover {
      &::after {
        border: 2px solid $cMainText;
      }
    }

    &.is-hover {
      &:hover {
        &::after {
          display: block;
        }
      }
    }
  }
}

.WidgetList-inner {
  flex: 1;
  min-width: 0;
}

.WidgetPlaceHolder {
  display: flex;
  flex: 1;
  margin-right: 24px;
}

.WidgetPlaceHolder-media {
  width: 32px;
  height: 32px;
  margin-right: 8px;
  border-radius: 2px;
  background: $cThirdBackground;
}

.WidgetPlaceHolder-txt {
  flex: 1;
}

.WidgetPlaceHolder-title {
  height: 16px;
  margin-bottom: 8px;
  border-radius: 2px;
  background: $cThirdBackground;
}

.WidgetPlaceHolder-text {
  height: 8px;
  border-radius: 2px;
  background: $cThirdBackground;
}

.Widget-selectTitle {
  width: 124px;
}

.Widget-categoryFake {
  box-sizing: border-box;
  height: 4px;
  margin-bottom: 16px;
  border-radius: 10px;
  background: $cSecondaryBackground;
}

.Widget-categoryFakeText {
  width: 100px;
  height: 4px;
  margin: 7px 0;
  border-radius: 10px;
  background: #F2F6F9;
}

.Widget-histogramFakeContainer {
  margin-bottom: 12px;
  padding-top: 1px;

  .Widget-categoryFakeText {
    margin-bottom: 9px;
  }
}

.Widget-histogramFake {
  position: relative;
  height: 20px;
  border-top: 1px solid $cSecondaryLine;
  border-bottom: 1px solid $cSecondaryLine;

  &::before {
    content: '';
    position: absolute;
    top: 50%;
    right: 0;
    left: 0;
    height: 1px;
    background: $cSecondaryLine;
  }
}

.Widget-formulaFakeContainer {
  margin-bottom: 12px;
  padding-top: 1px;
}

.Widget-formulaFake {
  position: relative;
  width: 96px;
  height: 20px;
  background: $cSecondaryLine;
}