Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <main>
  <h1>Continuous Integration (CI) Company Cost Savings Estimator</h1>
  <h3 class="ref-repo">
    <a class="ref-repo__link" href="https://github.com/yowainwright/developer-ci-benefits">
      <span class="ref-repo__span rainbow-animation">Learn more ➔</span>
      <span class="ref-repo__logo fab fa-github rainbow-animation"></span>
    </a>
  </h3>

  <section class="calculator">
    <hr />
    <div>
      <p class="calculator__text">The inputs below help calculate a basic estimate of the amount of savings that can be gained by implementing and Continuous Integration (CI). It can be used to make a case for implementing CI 😍.</p>
    </div>
    <hr />
    <div data-tooltip="e.g. pts, hrs">
      <label class="calculator__label">Productivity Per Sprint:</label>
      <input type="number" id="sprint-productivity" class="calculator__input">
      <span class="calculator__unit" />
    </div>

    <div data-tooltip="e.g. pts, hrs">
      <label class="calculator__label">Productivity Spent on Integration without CI:</label>
      <input type="number" id="sprint-no-ci-productivity-cost" class="calculator__input">
      <span class="calculator__unit" />
    </div>
    <div data-tooltip="e.g. pts, hrs">
      <label class="calculator__label">Productivity Spent on Integration with CI:</label>
      <input type="number" id="sprint-ci-productivity-cost" class="calculator__input">
      <span class="calculator__unit" />
    </div>
    <div>
      <label class="calculator__label">Average Developer Salary:</label>
      <span class="calculator__unit__left">$</span>
      <input type="number" id="approx-average-developer-salary-value" class="calculator__input">
      <span class="calculator__unit">.00</span>
    </div>
    <div>
      <label class="calculator__label">Number of Developers:</label>
      <input type="number" id="number-of-developers" class="calculator__input">
      <span class="calculator__unit"></span>
    </div>
    <button id="submit-savings">Estimate Savings</button>
    <hr />
    <div>
      <span class="calculator__label">CI Savings:</span>
      <span id="result" class="calculator__result">$0</span> </div>
  </section>
</main>
              
            
!

CSS

              
                body {
  background: #f7eec9;
  color: #07448e;
}
button {
  border-radius: 2.5px;
  color: #f9c7e4;
  cursor: pointer;
  background: #07448e;
  display: block;
  font-size: 1.5rem;
  margin: 0;
  padding: 0.5rem 0;
  width: 100%;
}
div {
  display: flex;
  flex-direction: row;
  margin: 2rem 0;
}

h1 {
  font-size: 2rem;
  margin: 3rem auto;
  text-align: center;
  @media (min-width: 60rem) {
    max-width: 50rem;
    font-size: 4.5rem;
  }
}
hr {
  margin: 2rem 0;
}
.calculator {
  display: block;
  font-weight: bold;
  margin: 0 auto;
  max-width: calc(100vw - 2rem);
  @media (min-width: 50rem) {
    max-width: 30rem;
  }
  &__input {
    border: 1px solid #07448e;
    border-radius: 2.5px;
    outline: 0;
    padding: 5px;
  }
  &__label {
    flex: 2 0 0;
    margin-right: 0.5rem;
  }
  &__text {
    font-size: 1.25rem;
    font-weight: normal;
    line-height: 1.75;
  }
  &__unit {
    padding-left: 5px;
    min-width: 50px;
    font-weight: 100;
    &__left {
      padding-left: 0px;
      padding-right: 5px;
      font-weight: 100;
    }
  }
}

.ref-repo {
  display: block;
  text-align: center;
  &__span {
    font-size: 2rem;
    margin-right: 10px;
  }
  &__logo {
    font-size: 2.5rem;
  }
  &__link {
    text-decoration: none;

    &:visited {
      color: #07448e;
    }
  }
}

.rainbow-animation {
  background: linear-gradient(to right, crimson, pink, springgreen, yellow);
  background-size: 500% 250%;
  display: inline-block;
  animation: rainbow 4s ease-in-out infinite;
  background-clip: text;
  -webkit-background-clip: text;
  transition: color 0.4s ease-in-out;
}

.rainbow-animation:hover {
  color: rgba(0, 0, 0, 0);
}

@keyframes rainbow {
  0% {
    background-position: left;
  }
  50% {
    background-position: right;
  }
  100% {
    background-position: left;
  }
}

/* Base styles for the element that has a tooltip */
[data-tooltip],
.tooltip {
  position: relative;
  cursor: pointer;
}

/* Base styles for the entire tooltip */
[data-tooltip]:before,
[data-tooltip]:after,
.tooltip:before,
.tooltip:after {
  position: absolute;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out,
    transform 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24);
  transform: translate3d(0, 0, 0);
  pointer-events: none;
}

[data-tooltip]:hover:before,
[data-tooltip]:hover:after,
[data-tooltip]:focus:before,
[data-tooltip]:focus:after,
.tooltip:hover:before,
.tooltip:hover:after,
.tooltip:focus:before,
.tooltip:focus:after {
  visibility: visible;
  opacity: 1;
}

.tooltip:before,
[data-tooltip]:before {
  z-index: 1001;
  border: 6px solid transparent;
  background: transparent;
  content: "";
}

/* Base styles for the tooltip's content area */
.tooltip:after,
[data-tooltip]:after {
  z-index: 1000;
  padding: 10px;
  border-radius: 5px;
  color: #f9c7e4;
  cursor: pointer;
  background: #07448e;
  content: attr(data-tooltip);
  line-height: 1.2;
}

/* Direction */
[data-tooltip]:before,
[data-tooltip]:after,
.tooltip:before,
.tooltip:after,
.tooltip-top:before,
.tooltip-top:after {
  bottom: 100%;
  left: 50%;
}

[data-tooltip]:before,
.tooltip:before,
.tooltip-top:before {
  margin-left: -6px;
  margin-bottom: -12px;
  border-top-color: #000;
  border-top-color: hsla(0, 0%, 20%, 0.9);
}

/* Horizontally align top/bottom tooltips */
[data-tooltip]:after,
.tooltip:after,
.tooltip-top:after {
  margin-left: -50px;
}

[data-tooltip]:hover:before,
[data-tooltip]:hover:after,
[data-tooltip]:focus:before,
[data-tooltip]:focus:after,
.tooltip:hover:before,
.tooltip:hover:after,
.tooltip:focus:before,
.tooltip:focus:after,
.tooltip-top:hover:before,
.tooltip-top:hover:after,
.tooltip-top:focus:before,
.tooltip-top:focus:after {
  -webkit-transform: translateY(-12px);
  -moz-transform: translateY(-12px);
  transform: translateY(-12px);
}

              
            
!

JS

              
                
const button = document.getElementById('submit-savings');
const result = document.getElementById('result');
const elValue = (id) => parseInt(document.getElementById(id).value);

/**
  * Tooltip code
  */
const anyInput = [...document.querySelectorAll('.calculator__input')];
const hideToolTip = () => {};
anyInput.forEach(el => {
  if (el) return el.addEventListener('blur', hideToolTip, false)
});

/**
  * Modal code
  */
const displayModal = (errMsg) => {
  const modal = document.createElement('div');
  modal.classList.add = 'modal';
  modal.id = 'modal'
  const modalText = `
      <button id="modal-button" class="modal__close">x</button>
    </div>`
  modal.textContent = modalText;
  document.body.appendChild(modal);
  document.getElementById('modal-button').addEventListener(
    'click', 
    document.getElementById('modal').remove(), 
    false
  );
};

const getEstimatedSavingsWithCI = () => {
  const productivity = elValue('sprint-productivity');
  const productivityNoCiCost = elValue('sprint-no-ci-productivity-cost');
  const productivityCiCost = elValue('sprint-ci-productivity-cost');
  const approxDevAvgSalary = elValue('approx-average-developer-salary-value');
  const numberOfDevelopers = elValue('number-of-developers');
  if (
    !productivity || 
    !productivityNoCiCost || 
    !productivityCiCost || 
    !approxDevAvgSalary || 
    !numberOfDevelopers
  ) return alert('All inputs must be filled out');
  if (
    productivity <= productivityNoCiCost ||  
    productivity <= productivityCiCost
  ) return alert('Productivity should be greater than Productivity Spent on Integration');
  if (
    productivityNoCiCost <= productivityCiCost
  ) return alert('Productivity should be better with CI');
  const productivitySpentOnCIWithoutCI = productivityNoCiCost / productivity;
  const productivitySpentOnCIWithCI = productivityCiCost / productivity;
  const lostProductivityWithCI = productivitySpentOnCIWithoutCI - productivitySpentOnCIWithCI;
  const costOfNotHavingCI = (approxDevAvgSalary * lostProductivityWithCI) * numberOfDevelopers;
  result.textContent = `$${costOfNotHavingCI.toFixed(2)}`;
}
button.addEventListener('click', getEstimatedSavingsWithCI)

              
            
!
999px

Console