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 includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

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="app">
  <main :class="`day--${(new Date()).getDay()}`">
    <h1>DSM Generator</h1>
    <div v-for="(day, index) in days">
      <h2>{{ capitalized(day) }}</h2>
      <div v-for="(text, index) in getDay(day)" class="item">
        <input :ref="`${day}-${index}`" type="text" v-model="getDay(day)[index]" @keyup.enter="add(day)">
        <input type="button" value="Remove" @click="remove(day, index)" tabindex="-1">
      </div>
      <input class="add" type="button" value="Add an item" @click="add(day)" tabindex="-1">
    </div>
  </main>
  <aside>
    <pre ref="dsm" @click="copyToClipboard">
*DSM*

**{{ previousDayLabel }}**
<template v-for="(text, index) in yesterday">- {{ text }}
</template>
**Today**
<template v-for="(text, index) in today">- {{ text }}
</template></pre>
    <p class="text-muted">
      📋 Click on the DSM to copy it ⚡
    </p>
  </aside>
</div>
              
            
!

CSS

              
                * {
  box-sizing: border-box;
}

body {
  color: #333;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  font-size: 120%;
  margin: 0 auto;
  max-width: 1080px;
}

#app {
  margin: 1rem 0;
  display: grid;
  grid-template-rows: 1fr;
  grid-column-gap: 20px;
  grid-row-gap: 0px; 
  grid-template-columns: 2fr 400px;
  grid-template-columns: minmax(0, 1fr) 400px;
}

main {
  padding: 1rem;
  width: 100%;
  background: #fef5ef;
  margin: 0 auto;
}

main.day--1 {
  background-image: linear-gradient(120deg, #84fab0 0%, #8fd3f4 100%);
}

main.day--2 {
  background-image: linear-gradient(120deg, #d4fc79 0%, #96e6a1 100%);
}

main.day--3 {
  background-image: linear-gradient(120deg, #89f7fe 0%, #66a6ff 100%);
}

main.day--4 {
  background-image: linear-gradient(to top, #fddb92 0%, #d1fdff 100%);
}

main.day--5 {
  background-image: linear-gradient(to top, #3f51b1 0%, #5a55ae 13%, #7b5fac 25%, #8f6aae 38%, #a86aa4 50%, #cc6b8e 62%, #f18271 75%, #f3a469 87%, #f7c978 100%);
}

h1 {
  color: #333;
  margin: 0 0 .5rem;
  text-decoration: underline;
}

h2 {
  color: #333;
}

input {
  border-radius: 2px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  box-sizing: border-box;
}

input[type=text] { 
  width: 75%;
  padding: 1em;
  border: 2px solid transparent;
}

input[type=button] {
  width: 20%;
  padding: 1em;
  border: 2px solid transparent;
  background: #fefefe;
  transition: background .15s ease-in-out;
}

input[type=button]:hover {
  background: #eeeefe;
}

input:focus {
  border: 2px solid #33a3f5;
  outline: none;
}

aside {
  
}

.item {
  margin-bottom: .5rem;
}

pre {
  overflow: auto;
  width: 100%;
  cursor: pointer;
}

.text-muted {
  color: #888;
  font-size: .8rem;
}
              
            
!

JS

              
                new Vue({
  el: '#app',
  data() {
    return {
      days: ['yesterday', 'today'],
      today: [],
      yesterday: []
    };
  },
  computed: {
    previousDayLabel() {
      return ((new Date()).getDay() === 1) ? 'Friday' : 'Yesterday';
    }
  },
  methods: {
    add(day) {
      this[day].push('');
      const refName = `${day}-${this[day].length-1}`;
      this.$nextTick(() => {
        this.$refs[refName][0].focus();
      });
    },
    remove(day,index) {
      this[day].splice(index, 1);
    },
    getDay(day) {
      return this[day];
    },
    getDayLabel(day) {
      return (day !== 'yesterday')
        ? this.previousDayLabel
        : this[day];
    },
    capitalized(str) {
      return str.charAt(0).toUpperCase() + str.slice(1);
    },
    copyToClipboard() {
      const dsm = this.$refs.dsm;
      const selection = window.getSelection();
      const range = document.createRange();
      range.selectNodeContents(dsm);
      selection.removeAllRanges();
      selection.addRange(range);
      document.execCommand("copy");
    }
  },
  mounted () {
    this.days.forEach(day => this.add(day));
    this.$nextTick(() => { 
      this.$refs['yesterday-0'][0].focus(); 
    });
  }
})
              
            
!
999px

Console