huridocs/uwazi

View on GitHub
app/react/App/scss/elements/_toggleButton.scss

Summary

Maintainability
Test Coverage
.toggleButton {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 27px;

  input {
    opacity: 0;
    width: 0;
    height: 0;
  }

  .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 34px;
    background-color: #ccc;
    -webkit-transition: 0.4s;
    transition: 0.4s;

    &:before {
      position: absolute;
      content: '';
      height: 25px;
      width: 25px;
      left: 1px;
      bottom: 1px;
      border-radius: 50%;
      background-color: white;
      -webkit-transition: 0.4s;
      transition: 0.4s;
    }
  }

  input:checked + .slider {
    background-color: #5cb85c;
  }

  input:focus + .slider {
    box-shadow: 0 0 1px #5cb85c;
  }

  input:checked + .slider:before {
    -webkit-transform: translateX(23px);
    -ms-transform: translateX(23px);
    transform: translateX(23px);
  }
}