Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div id="theApp"></div>

<div class="footer center contain">
  <p>Hello, I'm <a target="_blank" href="https://twitter.com/sixfoot3/">Tom</a>. I'm a <a target="blank" href="https://sixfoot3.com">programmer</a>.</p>
  <p> I stumbled across this very cool <a target="_blank" href="https://dribbble.com/shots/1920183-Coffee-Maker-App">Coffee Maker App</a> by <a target="_blank" href="https://twitter.com/galgalshir">Gal Shir</a> and turned it into a VueJS App.</p>
  </div>

<template id="appTemplate">
    <div class="contain">
      <header>
        <transition name="slide-fade" mode="out-in">
        <h1 :key="title">{{title}}</h1>
        </transition>
      </header>
    <main>
          <router-view></router-view>
    </main>
    </div>
</template>

<template id="home">
  <div>
    <div class="home center">
        <i class="fal fa-coffee fa-5x"></i>
        <p>Ready to order a coffee?</p>
        <router-link to="Size" class="btn">Start</router-link>
      </div>
  </div>
</template>
<template id="size">
  <div class="size">
    <div class="choices box">
      <div class="b" v-for="(choice, key) in choices" @click="itemSelected" v-bind:class="[choice.text]">
          <div class="icon">
            <i class="fal" v-bind:class="choice.icon"></i>
          </div>
          <span>{{choice.text}}</span>
      </div>
    </div>
  </div>
</template>

<template id="milktype">
<div class="milktype">
    <div class="choices box">
      <div class="b" v-for="(choice, key) in choices" @click="itemSelected" v-bind:class="[choice.text]">
          <div class="icon">
            <i class="fal" v-bind:class="choice.icon"></i>
          </div>
          <span>{{choice.text}}</span>
      </div>
    </div>
  </div>
</template>

<template id="milkbalance">
  <div class="milkbalance">
    <div class="percentage center">
      <h1>{{percentMilk}}%</h1>
    </div>
    <div class="slider">
       <vue-slider
        ref="slider"
        v-model="percentMilk"
        v-bind="slideOptions"
      ></vue-slider>
    </div>
<div class="center">
    <router-link to="Foam" class="btn">Next</router-link>
</div>
  </div>
</template>

<template id="foam">
  <div class="foam">
    <div class="percentage center">
      <h1>{{percentFoam}}%</h1>
    </div>
    <div class="slider">
       <vue-slider
        ref="slider"
        v-model="percentFoam"
        v-bind="slideOptions"
      ></vue-slider>
    </div>
<div class="center">
    <router-link to="order" class="btn">Place Order</router-link>
</div>
  </div>
</template>

<template id="order">
  <div class="order center">
    <h2>Thanks for your order!</h2>
    <h1>Order {{orderId}} </h1>
    
    <p>Your Order will be ready in </p>
    <p class="timer">{{time}}</p>
    <router-link to="/" class="btn">Order Again?</router-link>

  </div>
</template>
              
            
!

CSS

              
                $header_color: #d15169;
$main_color: #401f45;
$font_color: #f7d388;
$fff: #fff;

.slide-fade-enter-active {
  transition: all .2s ease;
}
.slide-fade-leave-active {
  transition: all .2s cubic-bezier(1.0, 0.5, 0.8, 1.0);
}
.slide-fade-enter, .slide-fade-leave-to
/* .slide-fade-leave-active for <2.1.8 */ {
  transform: translateX(10px);
  opacity: 0;
}

body {
  background: #ecdacf;
  padding: 25px;
  font-family: "Open Sans", sans-serif;
  font-weight:300;
  color: $font_color;
  font-size: 1em;
}

h1,h2,h3{
  font-weight:300;
  margin:0;
}


.btn{
  text-transform:uppercase;
  font-size:1em;
  padding:20px 0;
  display:block;
}


.center {
  text-align: center;
}

.contain {
  display: block;
  margin: 0 auto;
  max-width: 300px;

  a,
  label {
    color: $fff;
  }

  a {
    text-decoration: none;
  }

  header {
background: rgb(209,81,105);
background: linear-gradient(108deg, rgba(209,81,105,1) 0%, rgba(168,61,89,1) 100%);
    border-radius: 25px 25px 0 0;
    padding: 40px 25px;
    h1 {
      font-size: 1.2em;
    }
  }

  main {
    min-height:300px;
    overflow:hidden;
    border-radius: 0 0 25px 25px;
    background: $main_color;

    .home{
      padding:20px 10px;
    }
    
    .size {
      .b {
        @extend .center;
        padding: 40px 30px;
        font-size: 1.2em;
        width: 30%;
        .icon {
          padding: 20px 0;
          font-size: 3em;
        }
        
        &.selected{
          color:$fff;
        }
        
        &.Small {
          background:#9F4164;
          .icon {
            font-size: 1.5em;
          }
        }
        &.Medium {
          background:#6C2B59;
          .icon {
            font-size: 2em;
          }
        }
        &.Large {
          background:#49234C;
          .icon {
            font-size: 2.5em;
          }
        }
        &.XL {
          background:#2F173E;
          .icon {
            font-size: 3em;
          }
        }
      }
    }
    .milktype{
      .box{
        flex-wrap:nowrap;
        justify-content:center;
        flex-direction:column;
        .b{
          @extend .center;
          width:100%;
          padding:20px 20px;
          display:flex;
          line-height:3;
          color:$fff;
          .icon{
            color:$font_color;
            padding-right:30px;
            font-size:3em;
            line-height:1;
          }
          
          &.Cow{
            background:#4E274C;
          }
          
          &.Soy{
            background:#401F45;
          }
          
          &.Rice{
            background:#341945;
          }
          
          &.Coconut{
            background:#2F173E;
          }
          
            
        }
      }
    }
    
    .milkbalance{
      padding:40px 10px;
    }
    
    .foam{
      padding:40px 10px;
    }
    
    .order{
      padding:40px 10px;
      h1,h2{
        margin:15px 0;
      }
    }
    
  }
}

.box {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  flex-direction: row;
  .b {
    width: 49%;
    height: auto;
  }
}

.footer{
  font-size:.8em;
  line-height:1.6;
  color:$main_color;
  a{
    color:$header_color;
  }
}
              
            
!

JS

              
                const Screen = Vue.component("screen", {
  data() {
    return {
      title: "Default"
    };
  }
});

const Order = Vue.component("order", {
  extends: Screen,
  template: "#order",
  computed: {
    orderId: function(){
      return Math.floor(Math.random() * (100 - 1) ) + 1  
    },
    time: function(){
      return "5 Minutes"  
    },
  },
  data() {
    return {
      percentFoam: 50,
      slideOptions: {
        tooltip: false,
        height: 20,
        dotSize: 30,
        bgStyle: {
          backgroundColor: "#f7d388"
        },
        sliderStyle: {
          backgroundColor: "#fff"
        },
        processStyle: {
          backgroundColor: "#fff"
        }
      }
    };
  }
});

const Foam = Vue.component("foam", {
  extends: Screen,
  template: "#foam",
  components: {
    vueSlider: window["vue-slider-component"]
  },
  data() {
    return {
      percentFoam: 50,
      slideOptions: {
        tooltip: false,
        height: 20,
        dotSize: 30,
        bgStyle: {
          backgroundColor: "#f7d388"
        },
        sliderStyle: {
          backgroundColor: "#fff"
        },
        processStyle: {
          backgroundColor: "#fff"
        }
      }
    };
  }
});

const MilkBalance = Vue.component("MilkBalance", {
  extends: Screen,
  template: "#milkbalance",
  components: {
    vueSlider: window["vue-slider-component"]
  },
  data() {
    return {
      percentMilk: 50,
      slideOptions: {
        tooltip: false,
        height: 20,
        dotSize: 30,
        bgStyle: {
          backgroundColor: "#f7d388"
        },
        sliderStyle: {
          backgroundColor: "#fff"
        },
        processStyle: {
          backgroundColor: "#fff"
        }
      }
    };
  },

  methods: {
    itemSelected: function() {
      router.push("/foam");
    }
  }
});

const MilkType = Vue.component("MilkType", {
  extends: Screen,
  template: "#milktype",
  data() {
    return {
      choices: {
        small: {
          icon: "fa-coffee",
          text: "Cow"
        },
        medium: {
          icon: "fa-coffee",
          text: "Soy"
        },
        large: {
          icon: "fa-coffee",
          text: "Rice"
        },
        xl: {
          icon: "fa-coffee",
          text: "Coconut"
        }
      }
    };
  },
  methods: {
    itemSelected: function() {
      router.push("/milkbalance");
    }
  }
});

const Size = Vue.component("Size", {
  extends: Screen,
  template: "#size",
  data() {
    return {
      choices: {
        small: {
          icon: "fa-coffee",
          text: "Small"
        },
        medium: {
          icon: "fa-coffee",
          text: "Medium"
        },
        large: {
          icon: "fa-coffee",
          text: "Large"
        },
        xl: {
          icon: "fa-coffee",
          text: "XL"
        }
      }
    };
  },
  methods: {
    itemSelected: function() {
      router.push("/milktype");
    }
  }
});

const Home = Vue.component("Home", {
  extends: Screen,
  template: "#home",
});

const routes = [
  { path: "/", name: "Welcome", component: Home },
  { path: "/size", name: "Size", component: Size },
  { path: "/milktype", name: "Milk Type", component: MilkType },
  { path: "/milkbalance", name: "Milk Balance", component: MilkBalance },
  { path: "/foam", name: "Foam", component: Foam },
  { path: "/order", name: "Order Complete", component: Order }
];

const router = new VueRouter({
  routes
});

const app = new Vue({
  router,
  el: "#theApp",
  template: "#appTemplate",
  data(){
    return{
      title: "Welcome"
    };
  },
  watch: {
    '$route' (to, from) {
      this.title = to.name
    }
  }
});

              
            
!
999px

Console