CartoDB/cartodb20

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

Summary

Maintainability
Test Coverage
@import '~cartoassets/src/scss/cdb-variables/colors';
@import '~cartoassets/src/scss/cdb-variables/sizes';

.BlockList {
  position: relative;
  margin-bottom: $baseSize;
}

.BlockList-item {
  display: flex;
  position: relative;
  margin-bottom: $baseSize;
  padding: $baseSize * 2;
  transition:
    border 200ms ease-in,
    box-shadow 300ms ease-in;
  border: 1px solid $cMainLine;
  border-radius: $baseSize / 2;
  background: $cWhite;
  cursor: pointer;

  &.is-space {
    align-items: center;
    justify-content: space-between;
  }

  &.is-dashed {
    border-style: dashed;
  }

  &.is-dashed.no-hover:hover {
    border: 1px dashed $cMainLine;
    cursor: default;
  }

  &.ui-sortable-helper {
    box-shadow: 0 8px 16px  rgba(#000, 0.16);

    &:hover {
      border: 1px solid $cMainLine;
    }
  }

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

  &:hover {
    transition: border 200ms ease-in;
    border: 1px solid $cBlueHover;

    .BlockList-dragIcon {
      opacity: 1;
    }

    .BlockList-titleText {
      text-decoration: underline;
    }
  }
}

.BlockList-item--noAction {
  cursor: default;

  &:hover {
    border: 1px solid $cMainLine;
  }

  .BlockList-titleText {
    text-decoration: none;
    cursor: default;
  }
}

.BlockList-inner {
  flex: 1;
}

.BlockList-title {
  display: flex;
  margin-bottom: 2px;
}

.BlockList-titleText {
  flex: 1;
  width: 0;
  padding-right: $baseSize * 2;
  cursor: pointer;
}

.BlockList-dragIcon {
  position: absolute;
  top: 28px;
  left: -20px;
  transition: opacity 200ms ease-in;
  opacity: 0;
}

.BlockList-media {
  display: flex;
  position: relative;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  width: 40px;
  min-width: 40px;
  height: 40px;
  overflow: hidden;
  border-radius: $baseSize / 2;

  &::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    border: 1px solid rgba(#000, 0.08);
    border-radius: $halfBaseSize;
    pointer-events: none;
  }
}

.BlockList-mediaImg {
  width: 100%;
}

.BlockList-item--basemap {
  padding: 10px $baseSize * 2;

  .BlockList-inner {
    display: flex;
    align-items: center;
  }

  .BlockList-media {
    width: 16px;
    min-width: 16px;
    height: 16px;
    border-radius: 2px;
  }
}

.HorizontalBlockList {
  display: flex;
  max-width: 264px; /* remove when add new scroll */
  overflow: visible; /* for class with .has-error to be visible */
}

.HorizontalBlockList-item {
  display: flex;
  position: relative;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  width: 40px;
  min-width: 40px;
  height: 40px;
  margin-right: 8px;
  border: 1px solid $cMainLine;
  border-radius: 4px;
  background: $cThirdBackground;
  color: $cAltText;

  &.is-add {
    background: $cBlue;

    &:hover {
      background: darken($cBlue, 8%);
    }
  }

  &.is-selected {
    color: $cWhite;
  }

  &:first-child::before {
    display: none;
  }

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

  &::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -9px;
    width: 8px;
    height: 1px;
    background: $cMainLine;
  }
}

.HorizontalBlockList-item-actionBlock {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.HorizontalBlockList-item-text,
.HorizontalBlockList-item-icon {
  display: inline-block;
  vertical-align: top;
}