18F/micropurchase

View on GitHub
app/assets/stylesheets/components/_drawer.scss

Summary

Maintainability
Test Coverage
$drawer-width: 150px;

drawer {
  @include transition(right, 0.3s);

  background: $branding-darkest;
  border: 4px solid $branding-bright;
  border-right: none;
  border-top: none;
  color: $color-white;
  font-weight: $font-light;
  height: auto;
  overflow-y: auto;
  padding: $site-margins;
  position: fixed;
  top: 0;
  width: $drawer-width;
  z-index: 1000;

  &[aria-hidden=true] {
    display: block !important;
    right: (-1 * $drawer-width);

  }

  &[aria-hidden=false] {
    right: 0;

    @include media($small-screen) {
      right: (-1 * $drawer-width);
    }
  }
}

drawer button[data-drawer-toggle="menu"],
drawer button[data-drawer-toggle="close"] {
  border-radius: 0;
  margin: 0;
  max-width: 100px;
  position: absolute;
  top: 0;
}

drawer button[data-drawer-toggle="menu"],
#opportunity button[data-drawer-toggle="menu"] {
  left: 100%;
  display: none;
}

drawer button[data-drawer-toggle="close"] {
  background: transparent;
  padding: 10px;
  right: 0;
  width: 38px;
}

drawer[aria-hidden=true],
#opportunity {
  button[data-drawer-toggle="menu"] {
    display: block;
  }

  button[data-drawer-toggle="close"] {
    display: none;
  }
}

drawer[aria-hidden=false],
#opportunity {
  button[data-drawer-toggle="menu"] {
    display: none;
  }

  button[data-drawer-toggle="close"] {
    display: block;
  }
}

drawer form {
  margin-right: 1px;
}