podemos-info/census

View on GitHub
app/assets/stylesheets/common/_data_picker.scss

Summary

Maintainability
Test Coverage
.modal {
  display: none;
}

.vanilla-modal .modal {
  display: block;
  position: fixed;
  content: "";
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.2s, z-index 0s 0.2s;
  text-align: center;
  overflow: hidden;
  overflow-y: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}

.vanilla-modal .modal > * {
  display: inline-block;
  white-space: normal;
  vertical-align: middle;
  text-align: left;
}

.vanilla-modal .modal:before {
  display: inline-block;
  overflow: hidden;
  width: 0;
  height: 100%;
  vertical-align: middle;
  content: "";
}

.vanilla-modal.modal-visible .modal {
  z-index: 99;
  opacity: 1;
  transition: opacity 0.2s;
}

.modal-inner {
  position: relative;
  overflow: hidden;
  width: 90%;
  height: 90%;
  overflow-x: hidden;
  overflow-y: auto;
  background: #fff;
  z-index: -1;
  opacity: 0;
  transform: scale(0);
  transition: opacity 0.2s, transform 0.2s, z-index 0s 0.2s;
  @media screen and (min-width: 576px) {
    width: auto;
    max-width: 90%;
    max-height: 700px;
    min-width: 500px;
  }
}
.modal-visible .modal-inner {
  z-index: 100;
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.2s, transform 0.2s;
}

.modal-inner > [data-modal-close] {
  position: absolute;
  z-index: 2;
  right: 0;
  top: 0;
  width: 25px;
  height: 25px;
  line-height: 25px;
  font-size: 13px;
  cursor: pointer;
  text-align: center;
  background: #fff;
  box-shadow: -1px 1px 2px rgba(0,0,0,0.2);
}

.modal-hider {
  display: none;
}

.data-picker {
  cursor: pointer;
  border: 1px solid #e4eaec;
  outline: 0;
  border-radius: 3px;
  padding: 6px 12px;

  @media screen and (min-width: 576px) {
    width: 50%;
    display: inline-block;
  }
}

.picker-container {
  display: none;
}

.modal-content {
  display: flex;
  flex-direction: column;
  max-height: 100%;
  min-height: 100%;

  .picker-header {
    order: 1;
    padding: 5px;
    h2 {
      font-size: 18px;
      margin: 0px 0px 5px;
    }
    li ~ li a:before {
      content: '';
      width: 10px;
      height: 2em;
      float: left;
    }
    li:last-child a {
      color: #333;
    }
    a {
      display: block;
      padding: 2px;
    }
  }

  .picker-footer {
    order: 10;
  }

  .picker-content {
    order: 5;
    flex-grow: 10;
    min-height: 100%;
    max-height: 100%;
    overflow: auto;

    .picker-scrollable-content {
      max-height: 100%;
      overflow: auto;
      scroll-snap-type: mandatory;

      a {
        scroll-snap-coordinate: 0px 0px;
        display: block;
        width: 100%;
        border-top: 1px solid #eee;
        line-height: 1.5rem;
        padding: 5px;
        &:hover {
          background: #eee;
        }
      }
    }
  }

  .buttons {
    display: flex;
    justify-content: center;
    padding: 5px;

    .btn {
      -webkit-transition: border 0.2s linear, color 0.2s linear, width 0.2s linear, background-color 0.2s linear;
      -o-transition: border 0.2s linear, color 0.2s linear, width 0.2s linear, background-color 0.2s linear;
      transition: border 0.2s linear, color 0.2s linear, width 0.2s linear, background-color 0.2s linear;
      cursor: pointer;
      margin: 5px;
      border-radius: 3px;
      padding: 6px 12px;
    }
    .btn-ok {
      background-color: $primary-color;
      color: white;
      font-weigth: bold;
    }
    .btn-disable {
      background-color: $disable-color;
      color: white;
    }
  }
}