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">
  <set-pricing></set-pricing>
</div>
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css2?family=Inter:wght@200;300;400;500;600;700;800&display=swap");

$main-text: #292b2c;
$subtitle: #8a8d92;
$accent: #2656ff;

* {
  box-sizing: border-box;
}
body {
  font-family: "Inter", sans-serif;
  background: #e4e9f3;
  display: flex;
  height: 100vh;
}

#app {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.pricing {
  &-container {
    background: white;
    max-width: 350px;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 20px 40px 0 rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.1);
  }

  &-title {
    font-weight: 600;
    font-size: 18px;
    color: $main-text;
  }

  &-subtitle {
    color: $subtitle;
    font-size: 15px;
  }

  &-options {
    display: flex;
    justify-content: space-between;
    .btn {
      width: 48%;
      background: white;
      border: 2px solid #dadde1;
      color: $main-text;
      padding: 15px;
      font-size: 14px;
      border-radius: 5px;
      font-weight: 600;
      margin: 20px 0 20px 0;
      outline: none;
      transition: 0.4s all ease;
      cursor: pointer;

      &:hover {
        transition: 0.2s all ease;
        border: 2px solid #90aaff;
      }

      &.hourly span {
        margin-right: 5px;
      }

      &.fixed span {
        margin-right: 10px;
      }
    }

    .active {
      background: #f2f5ff;
      border: 2px solid #90aaff;
    }
  }

  &-slider-container {
    margin: 20px 0;
    .price {
      display: flex;
      margin: 10px 0;
    }
    .dollar-sign,
    .per-hour {
      color: $subtitle;
      font-size: 14px;
      margin: 0 4px;
    }

    .per-hour {
      align-self: flex-end;
    }
    .price-value {
      font-size: 25px;
      font-weight: 400;
    }
  }
}

// range slider might not work in all browsers
input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  background-color: #e2e6eb;
  border-radius: 8px;
  height: 5px;
  width: 100%;
  outline: none;
  transition: background 450ms ease-in;
  position: absolute;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 10px;
  -webkit-appearance: none;
  color: $accent;
  margin-top: -4px;
}

input[type="range"]::-webkit-slider-thumb {
  width: 20px;
  -webkit-appearance: none;
  height: 20px;
  cursor: ew-resize;
  background: $accent;
  border-radius: 100%;
  margin-top: -4px;
}

.pricing-slider {
  width: 100%;

  .slider-label {
    width: 100%;
    display: flex;
    justify-content: space-between;
    color: $subtitle;
    margin-top: 5px;
    font-size: 14px;
    font-weight: 500;
  }

  .custom-slider {
    position: relative;
    display: flex;
    align-items: center;
    height: 15px;
    width: 100%;
  }

  .range-input {
    top: 0;
  }

  .range-background {
    background: $accent;
    width: 0;
    height: 6px;
    border-radius: 8px;
    position: absolute;
    top: 0;
  }
}

.fixed-price-container {
  .fixed-input {
    height: 30px;
    background: #f8fafc;
    width: 30%;
    border: 1px solid #dadde1;
    outline: none;
    font-size: 14px;
    padding-left: 5px;
  }

  span {
    font-size: 14px;
    color: $main-text;
    margin-right: 3px;
  }
}

@media (max-width: 250px) {
  body {
    height: auto;
  }
  #app {
    padding: 5px;
    display: block;
  }
  .pricing-container {
    padding: 20px;
    width: 100%;
  }
}

              
            
!

JS

              
                let setPricing = Vue.component("set-pricing", {
  template: `
    <div class="pricing-container">
      <div class="pricing-title">Set up your hourly pricing </div>
      <p class="pricing-subtitle"> Please set up your hourly or fixed rate so that client is aware of your pricing. </p>
    <div class="pricing-options">
        <button class="btn hourly" :class="{ active: hourly }" @click="hourly = !hourly"><span><i class="far fa-clock"></i></span> Hourly</button>
        <button class="btn fixed" :class="{ active: !hourly }" @click="hourly = !hourly"><span> <i class="fas fa-user-lock"></i></span>Fixed</button>
     </div>

    <div class="pricing-slider-container" v-show="hourly">
       <div class="price"> <span class="dollar-sign"> $</span> <div class="price-value"> {{ price }}</div>  <span class="per-hour"> / hour </span> </div>
        <div class="pricing-slider"> 
          <div class="custom-slider">
            <input class="range-input" type="range" min="0" max="300" value="150" v-on:input="updateSlider" v-model="price">
            <div class="range-background"></div>    
          </div>
          <div class="slider-label"> 
            <label for="">$0</label>
            <label for="">$300</label>
          </div>
      </div>
    </div>
    <div class="fixed-price-container" v-show="!hourly">
        <span> $ </span> <input type="text" class="fixed-input"> <span> / project</span>
    </div>
   </div>
  `,
  mounted() {
    this.updateSlider();
  },
  methods: {
    updateSlider(e) {
      let el = e ? e.target : document.querySelector(".range-input");
      let siblingEl = el
        ? el.nextElementSibling
        : document.querySelector(".range-background");
      let value = el.value || this.price;
      siblingEl.style.width = (el.value / 300) * 100 + "%";
      this.price = el.value;
    }
  },
  data() {
    return {
      price: 180,
      hourly: true
    };
  }
});

new Vue({
  el: "#app",
  components: {
    setPricing: setPricing
  }
});

              
            
!
999px

Console