import Velocity from "velocity-animate";

(function($) {
  "use strict";

  // Show code or preview
  $("body").on("change", ".show-code", function() {
    let elementId = $(this).data("target");
    if ($(this).is(":checked")) {
      $(elementId)
        .find(".preview")
        .hide();
      Velocity($(elementId).find(".source-code"), "fadeIn", {
        duration: 300
      });
    } else {
      Velocity($(elementId).find(".preview"), "fadeIn", {
        duration: 300
      });
      $(elementId)
        .find(".source-code")
        .hide();
    }
  });
})($);
