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 class="bannerPadder pageContainer" style="padding-top: 80px">
  <div id="loadingIndicator"></div>
  <div id="postLoad" style="display: none">
    <div class="playgroundTitle" id="playground">
      <h1>Give it a spin</h1>
      <div class="subtitle">How can Statsig power your features?</div>
    </div>
    <div class="playgroundResult" id="playgroundResult">
      <div class="bannerLeftRight">
        <div class="bannerLeft" style="flex: 1 1 20%;">
          <img id="shirtImage" src="https://www.statsig.com/images/playground_shirt_light.png" class="bannerImage">
        </div>
        <div class="bannerRight playgroundContent">
          <img id="descriptionImage" class="descriptionImage" src="https://www.statsig.com/images/playground_description_light.png">
          <div style="margin-top: 30px;">
            <span class="originalPrice">$20.00</span>
          </div>
          <div class="finalPrice">
            <span id="finalPriceSpan">$18.00</span>
            <span id="finalPriceOff" class="discount">(10% off)</span>
          </div>
          <div class="savings">
            <img id="couponImage" src="https://www.statsig.com/images/playground_coupon_light.png">
            <div>YOU SAVE: </div>
            <div id="dollarSavings" class="dollarSavings">$2.00</div>
          </div>
          <div class="savingsFooter">
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
              
            
!

CSS

              
                #loadingIndicator {
  border: 16px solid #f3f3f3; /* Light grey */
  border-top: 16px solid #005a99; /* Blue */
  border-radius: 50%;
  width: 120px;
  height: 120px;
  animation: spin 2s linear infinite;
  margin-left: auto;
  margin-right: auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.bannerPadder {
  padding-top: 120px;
  padding-bottom: 120px;
}

.bannerLeftRight {
  display: flex;
  flex-direction: row;
}

.heroBanner .bannerLeftRight {
  padding-top: 0;
  padding-bottom: 0;
}

.bannerLeft,
.bannerRight {
  align-items: center;
  display: flex;
  flex: 1 0;
  font-size: 18px;
  line-height: 32px;
  position: relative;
}

.bannerMid {
  align-items: center;
  justify-content: center;
  display: flex;
  flex: 0;
  padding: 0 32px;
}

.bannerLeft {
  order: 0;
}

.bannerMid {
  order: 1;
}

.bannerRight {
  order: 2;
}

.bannerLeft .bannerImage,
.bannerRight .bannerImage {
  width: 100%;
}

.textLeft {
  padding-right: 100px;
  text-align: left;
}

.textRight {
  padding-left: 100px;
  text-align: left;
}

.heroBannerImage .bannerImage {
  width: 130%;
}

.playgroundTitle {
  margin-bottom: 32px;
}

.playgroundTitle h1 {
  margin: 0;
}

.playgroundResult {
  background-color: #f7f7f7;
  box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 60px;
  transition: background-color 0.5s ease;
}

.playgroundResult.darkMode {
  background-color: #16232a;
}

.playgroundResult .playgroundContent {
  display: block;
  padding: 0 40px;
  text-align: left;
}

.playgroundResult .playgroundContent .descriptionImage {
  max-width: 100%;
}

.playgroundResult .originalPrice {
  color: #9b9b9b;
  font-size: 32px;
  font-weight: bold;
  text-decoration: line-through;
}

.playgroundResult .finalPrice {
  color: #414141;
  font-size: 48px;
  font-weight: bold;
  margin-top: 20px;
  transition: color 1.5s ease;
}

.playgroundResult.darkMode .finalPrice {
  color: #fff;
}

.playgroundResult .discount {
  color: #9b9b9b;
  font-size: 14px;
  font-weight: normal;
}

.playgroundResult .savings {
  border: 1px dashed #9b9b9b;
  border-radius: 4px;
  color: #414141;
  display: flex;
  font-size: 16px;
  font-weight: bold;
  justify-content: space-evenly;
  margin-top: 20px;
  padding: 20px;
  text-align: center;
  transition: color 0.5s ease;
  width: 100%;
}

.playgroundResult.darkMode .savings {
  color: #eee;
}

.playgroundResult .savings div {
  display: flex;
  align-items: center;
}

.playgroundResult .dollarSavings {
  font-size: 32px;
}

.playgroundResult .savingsFooter {
  background-color: #ced2d3;
  border-radius: 8px;
  height: 40px;
  margin-top: 20px;
  width: 100%;
}


@media screen and (max-width: 920px) {
  .textRight {
    padding-left: 20px;
  }
  .textLeft,
  .heroText.textLeft {
    padding-right: 20px;
  }
}

@media screen and (max-width: 720px) {
  .bannerLeftRight {
    display: block;
    padding-top: 0px;
    padding-bottom: 0px;
  }

  .bannerRight,
  .bannerLeft {
    padding: 32px 0;
    font-size: 18px;
    line-height: 24px;
  }

  .textRight,
  .textLeft {
    padding: 0;
    text-align: center;
  }

  .heroText.textLeft {
    padding-right: 0;
  }

  .bannerLeft .bannerImage,
  .bannerRight .bannerImage {
    margin-bottom: 32px;
  }

  .heroBannerImage .bannerImage {
    width: 100%;
  }

  .heroText h1 {
    font-size: 40px;
  }

  .heroText h3 {
    font-size: 16px;
  }

  .playgroundTitle {
    margin-bottom: 0;
  }

  .codeWindow {
    font-size: 16px;
    width: 100%;
  }

  .playgroundResult {
    padding: 16px;
  }

  .playgroundResult .playgroundContent {
    padding: 0 16px;
  }

  .configPlayground .configList {
    font-size: 16px;
    padding: 0 16px;
  }
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  display: flex;
  flex-direction: column;
}
body {
  color: #3b3b3b;
  font-size: 16px;
  font-weight: 300;
  font-family: 'Nunito', Helvetica, 'Segoe UI', Arial;
  justify-content: center;
  margin: 0;
  padding: 0;
  text-align: center;
}
h1,
h2,
h3,
h4,
h5 {
  font-family: 'Montserrat', Helvetica, 'Segoe UI', Arial;
  line-height: 125%;
}

h1 {
  color: #3b3b3b;
  font-size: 40px;
  font-weight: bold;
  margin-bottom: 0px;
}
h2 {
  color: #3b3b3b;
  font-size: 30px;
  font-weight: bold;
  margin: 16px 0 8px 0;
}
h3 {
  color: #194b7d;
  font-size: 24px;
  font-weight: 500;
  margin: 8px 0 4px 0;
}
h4 {
  color: #194b7d;
  font-size: 18px;
  font-weight: 600;
  margin-top: 5px;
  margin-bottom: 4px;
}
h5 {
  color: #3b3b3b;
  font-size: 16px;
  font-weight: bold;
  margin-top: 5px;
  margin-bottom: 4px;
}
a {
  color: #194b7d;
  text-decoration: none;
}


.pageContainer {
  box-sizing: border-box;
  margin-bottom: auto;
  margin-left: auto;
  margin-right: auto;
  max-width: 1200px;
  padding: 0 16px;
  width: 100%;
}

.heroBanner {
  background: linear-gradient(#fff, #f7f7f7);
  padding-top: 120px;
  padding-bottom: 120px;
}

@media screen and (max-width: 1200px) {
  .pageContainer {
    padding: 0 32px;
  }
}

@media screen and (max-width: 720px) {
  .pageContainer {
    padding: 0 16px;
  }

  body {
    justify-content: flex-start;
  }

  h1 {
    font-size: 24px;
  }
  h2 {
    font-size: 20px;
  }
  h3 {
    font-size: 18px;
  }
  h4 {
    font-size: 16px;
  }
  h5 {
    font-size: 14px;
  }
}

              
            
!

JS

              
                let $d = document.getElementById.bind(document);

window.addEventListener("load", function () {
  // go to https://console.statsig.com/2TS05afaGOfFesEYTm7lY9
  // to see the feature gates/configs
  statsig
    .initialize("client-GoMnSFheRdU8VJHvCPbEMtjxd9l3fk8rZwnSuLxIPD9", {
      custom: {
        // Try changing this!
        engagementLevel: "HIGH" // "LOW" 
      }
    })
    .then(function () {
      statsig.logEvent("page_view", "product_details");
      $d("postLoad").style.display = "unset";
      $d("loadingIndicator").style.display = "none";

      updateDiscount();
      setTheme();
    });
});

function setTheme() {
  const dark = statsig.checkGate("dark_mode");
  $d("playgroundResult").classList[dark ? "add" : "remove"]("darkMode");
  $d("couponImage").src = `https://www.statsig.com/images/playground_coupon_${
    dark ? "dark" : "light"
  }.png`;
  $d("shirtImage").src = `https://www.statsig.com/images/playground_shirt_${
    dark ? "dark" : "light"
  }.png`;
  $d(
    "descriptionImage"
  ).src = `https://www.statsig.com/images/playground_description_${
    dark ? "dark" : "light"
  }.png`;
}

function updateDiscount() {
  // try the final_sale discount instead!
  // statsig.getConfig("tshirt_details")?.getValue("finalSale") ?? 0
  const discount = statsig.getConfig("tshirt_details")?.getValue("discount") ?? 0;
  const off = (discount * 20) / 100;
  $d("finalPriceSpan").innerText = `$${(20 - off).toFixed(2)}`;
  $d("finalPriceOff").innerText = `(${discount}% off)`;
  $d("dollarSavings").innerText = `$${off.toFixed(2)}`;
}

              
            
!
999px

Console