Drawer

by WILLIAM CORREA

HTML

<script src="https://rawgit.com/yyx990803/vue/master/dist/vue.js"></script>
<div id="app">
  <div class="app">
    <button @click="open = true">Abrir</button>
  </div>
  <div :class="[open ? 'open' : '']" class="drawer">
    <div class="content">
      <div class="inner">
        <button @click="open = false">Fechar</button>
      </div>
    </div>
  </div>
</div>

CSS

.drawer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,.5);
  transform: translate(0, -100%);
  transition: transform .005s;
}
.drawer.open {
  transform: translate(0, 0);
  transition: transform .05s;
}

.drawer .content {
  position: absolute;
  background: #fff;
  width: 200px;
  height: 100%;
  top: 0;
  left: 0;
  bottom: 0;
  transform: translate(-200px, 0);
  transition: transform .5s;
}
.drawer.open .content {
  transform: translate(0, 0);
  box-shadow: 0 0 10px 0px rgba(0, 0, 0, 0.35);
}
.drawer .content .inner {
   padding: 10px;
}

JavaScript

new Vue({
  el: '#app',
  data: {
    open: false
  }
});