Vue

by Alex Kyriakidis

HTML

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.js"></script>
<div id="app">
  <github-user-card username="hootlex"></github-user-card>
  <github-user-card username="rahaug"></github-user-card>
</div>

<script type="text/x-template" id="github-user-card-template">
<div class="ui card">
  <div class="image">
    <img :src="user.avatar_url">
  </div>
  <div class="content">
    <a class="header">{{user.name}}</a>
    <div class="meta">
      <span class="date">Joined in {{user.created_at}}</span>
    </div>
    <div class="description">
      {{user.bio}}
    </div>
  </div>
  <div class="extra content">
    <a>
      <i class="user icon"></i>
      {{user.followers}} Followers
    </a>
  </div>
</div>
</script>

CSS

body {
  background: #20262E;
  padding: 20px;
  font-family: Helvetica;
}

#app {
  background: #fff;
  border-radius: 4px;
  padding: 20px;
  transition: all 0.2s;
}

li {
  margin: 8px 0;
}

h2 {
  font-weight: bold;
  margin-bottom: 15px;
}

del {
  color: rgba(0, 0, 0, 0.3);
}

Vue

Vue.component('github-user-card', {
	props: ['username'],
  template: '#github-user-card-template',
  data () {
  	return { user: {} }
  },
  created () {
  	axios.get(`https://api.github.com/users/${this.username}`)
    .then(response => {
    	this.user = response.data
    	console.log(response, this.user)
    })
  }

})

new Vue({
  el: "#app",
  data: {
    todos: [
      { text: "Learn JavaScript", done: false },
      { text: "Learn Vue", done: false },
      { text: "Play around in JSFiddle", done: true },
      { text: "Build something awesome", done: true }
    ]
  },
  methods: {
  	toggle: function(todo){
    	todo.done = !todo.done
    }
  }
})