brainworxx/kreXX-TYPO3-Extension

View on GitHub
Resources/Private/Css/Includes/_switch.scss

Summary

Maintainability
Test Coverage
.krexx-backend {
  input.switch {
    height: 0;
    width: 0;
    visibility: hidden;
  }

  span.switch {
    cursor: pointer;
    text-indent: -9999px;
    width: 20px;
    height: 11px;
    background: $black;
    display: block;
    border-radius: 15px;
    position: relative;
    min-height: auto;
    margin-top: 10px;
    margin-left: 5px;

    &::after {
      content: '';
      position: absolute;
      top: 2px;
      left: 3px;
      width: 7px;
      height: 7px;
      background: $grey-10;
      border-radius: 5px;
      transition: 0.3s;
    }
  }

  .button:hover label span.switch::after {
    background: $grey-15;
  }

  input:checked + span.switch {
    background: $grey-25;
  }

  input.switch:checked + span.switch::after {
    left: calc(100% - 17px);
    transform: translateX(+100%);
  }
}