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

              
                <div id="app">
  <main v-if="user">
    <h1>Latest repositories starred</h1>
    <ul>
      <li v-for="repository in repositories">
        <a :href="repository.html_url" target="_blank">{{repository.name}}</a>
      </li>
    </ul>
    <p v-if="repositories.length === 0">Whoa, such empty!</p>
  </main>
  <div v-else>
    <button @click.prevent="connect">Connect to GitHub</button>
  </div>
</div>
              
            
!

CSS

              
                #app {
  font-family: Sans-serif;
  font-size: 14px;
  max-width: 695px;
}

#app div {
  text-align: center;
  width: 200px;
  margin: 0 auto;
}

#app div::before {
  display: inline-block;
  content: " ";
  width: 200px;
  height: 200px;
  background-image: url("https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png");
  background-size: cover;
}

ul {
  list-style: none;
  display: flex;
  flex-flow: row wrap;
  justify-content: space-between;
  margin: 0;
  padding: 0;
}

ul li {
  display: inline-block;
  width: 30%;
  margin: 8px;
}

ul li a {
  display: block;
  padding: 8px;
  border: 1px solid #d4d9ea;
  border-radius: 4px;
  box-shadow: 0 2px 4px 0 rgba(3, 13, 54, 0.26);
  text-decoration: none;
  color: black;
  overflow:hidden;
}

ul li a:hover {
  background-color: #FAFAFA;
}
              
            
!

JS

              
                var app = new Vue({
  el: "#app",
  data: {
    user: null,
    repositories: []
  },
  mounted: function() {
    // Here we initialize Pizzly.
    this.$pizzly = new Pizzly({
      host: "pushtogsheet.herokuapp.com",
      publishableKey: "pope8Qy8qfYyppnHRMgLMpQ8MuEUKDGeyhfGCj"
    });

    // If you don't have an account on Bearer.sh
    // create one for free at https://www.bearer.sh/signup
    // then grab your Bearer Publishable key
    // (pk_production...) in the settings page.
  },
  methods: {
    connect: function() {
      // Here, we create a new method
      // that "connect" a user to GitHub
      this.$pizzly
        .integration('github')
        .connect()
        .then(this.connectSuccess)
        .catch(this.connectError);
    },
    connectSuccess: function(data) {
      // On success, we update the user object
      console.log(data)
      this.user = data.authId;
      this.fetchStarringRepositories()
    },
    connectError: function (err) {
      console.error(err)
      alert("Something went wrong. Look at the logs.")
    },
    fetchStarringRepositories: function() {
      this.$pizzly
        .integration("github")
        .auth(this.user)
        .get("/user/starred")
        .then(response => response.json())
        .then((data) => { this.repositories = data })
        .catch(this.fetchError)
    },
    fetchError: function (err) {
      console.error(err)
      alert("Something went wrong. Look at the logs.")
    }
  }
});
              
            
!
999px

Console