JSFiddle - React, Tailwind, and code Playground

Copy to modal (With Apps) - VUE.js

by Hugo Carneiro

HTML

<script src="https://cdn.jsdelivr.net/vue/1.0.24/vue.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
<!-- template for the modal component -->
<script type="x/template" id="modal-template">
  <div class="modal-mask" v-show="show" transition="modal">
    <div class="modal-wrapper">
      <div class="modal-container">

        <div class="modal-header">
          <slot name="header">
            <h4>Where do you want to copy this screen to?</h4>
          </slot>
        </div>

        <div class="modal-body">
          <slot name="body">
            <p>The screen's layout, content, components and settings will be copied to the other app.</p>
            <form class="form-horizontal" id="copy_screen" action="#">
              <div class="form-group">
                <div class="col-xs-4 control-label">
                  <label for="link-type">Copy <strong>Welcome</strong> screen to...</label>
                </div>
                <div class="col-xs-8">

                  <label for="link-type" class="select-proxy-display">
                    <span class="icon fa fa-chevron-down"></span>
                    <span class="select-value-proxy">&mdash; Select an app &mdash;</span>

                    <select name="link_type" id="link-type" data-label="select" class="hidden-select form-control">
                      <option selected value="none">&mdash; Select an app &mdash;</option>
                      <option value="">My first app</option>
                      <option value="">2016 Report</option>
                      <option value="">To-do List</option>
                    </select>
                  </label>
                </div>
              </div>
            </form>
          </slot>
        </div>

        <div class="modal-footer">
          <slot name="footer">
            <div...

CSS

@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,700);
html,
body {
  font-family: "Open Sans", "Helvetica Neue", Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: 15px;
}

.menu {
  position: relative;
  z-index: 1000;
  float: left;
  min-width: 160px;
  padding: 5px 0;
  margin: 2px 0 0;
  list-style: none;
  font-size: 14px;
  text-align: left;
  background-color: #fff;
  border: 1px solid #ccc;
  border: 1px solid rgba(0, 0, 0, .15);
  border-radius: 4px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
  background-clip: padding-box;
}

.menu>li>a {
  display: block;
  padding: 3px 20px;
  clear: both;
  font-weight: 400;
  line-height: 1.42857;
  color: #333;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
}

.menu>li>a:focus,
.menu>li>a:hover {
  text-decoration: none;
  color: #262626;
  background-color: #f5f5f5;
}

.modal-mask {
  position: fixed;
  z-index: 9998;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, .5);
  display: table;
  transition: opacity .3s ease;
}

.modal-wrapper {
  display: table-cell;
  vertical-align: middle;
}

.modal-container {
  max-width: 500px;
  margin: 0px auto;
  background-color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .33);
  transition: all .3s ease;
  overflow: hidden;
}

.modal-header {
  position: relative;
  z-index: 2;
  margin-top: 0;
  color: #14505e;
  padding: 20px;
  box-shadow: 0 0 10px rgba(51, 51, 51, .3);
}

.modal-body {
  padding: 30px 20px;
  background-color: #f2f6f7;
}

.modal-default-button {
  float: right;
}


/*
 * the following styles are auto-applied to elements with
 * v-transition="modal" when their visiblity is toggled
 * by Vue.js.
 *
 * You can easily play with the modal transition by editing
 * these styles.
 */

.modal-enter,
.modal-leave {
  opacity: 0;
}

.modal-enter .modal-container,
.modal-leave .modal-container {
  -webkit-transform: scale(1.1);
  transform:...

JavaScript

// register modal component
Vue.component('modal', {
  template: '#modal-template',
  props: {
    show: {
      type: Boolean,
      required: true,
      twoWay: true
    }
  }
})

// start app
new Vue({
  el: '#app',
  data: {
    showModal: false
  }
})

$('#link-type').on('change', function() {
  var selectedValue = $(this).val();
  var selectedText = $(this).find("option:selected").text();
  $('.section.show').removeClass('show');
  $('#' + selectedValue).addClass('show');
  $(this).parents('.select-proxy-display').find('.select-value-proxy').html(selectedText);
});