mirror of
https://github.com/koodiklinikka/koodiklinikka.fi.git
synced 2026-03-02 03:59:05 +00:00
turn code examples into javascript and update readme
This commit is contained in:
@@ -1 +0,0 @@
|
||||
console.log 'foobar'
|
||||
33
src/js/main.js
Normal file
33
src/js/main.js
Normal file
@@ -0,0 +1,33 @@
|
||||
'use strict';
|
||||
|
||||
import {partialRight, invoke} from 'lodash';
|
||||
|
||||
Promise.all([
|
||||
fetch('https://api.github.com/repos/leonidas/gulp-project-template'),
|
||||
fetch('https://api.github.com/repos/leonidas/gulp-project-template/commits')
|
||||
])
|
||||
.then(partialRight(invoke, 'json'))
|
||||
.then(Promise.all.bind(Promise))
|
||||
.then(data => {
|
||||
|
||||
const [repository, commits] = data;
|
||||
const {html_url, description, full_name} = repository;
|
||||
|
||||
const commitItems = commits.map(item => {
|
||||
const {commit} = item;
|
||||
|
||||
return `
|
||||
<li>
|
||||
<span>${commit.message.replace(/\n/g, '<br />')}<span>
|
||||
<br /><br />
|
||||
<small>${commit.committer.name}</small>
|
||||
</li>`;
|
||||
});
|
||||
|
||||
document.body.innerHTML = `
|
||||
<h1>${description}</h1>
|
||||
<h2><a href="${html_url}">${full_name}</a></h2>
|
||||
<ul>${commitItems.join('')}</ul>
|
||||
`;
|
||||
});
|
||||
|
||||
@@ -1,2 +1,23 @@
|
||||
body, html
|
||||
margin 0
|
||||
padding 1em
|
||||
font 14px/1.4 'Helvetica Neue', Helvetica, Arial
|
||||
color #333
|
||||
|
||||
li
|
||||
margin 1em 0
|
||||
padding 1em 0
|
||||
border-bottom 1px solid #eee
|
||||
|
||||
h1
|
||||
margin-bottom 0
|
||||
|
||||
h2
|
||||
margin-top 0
|
||||
|
||||
ul
|
||||
margin-top 2em
|
||||
|
||||
li
|
||||
small
|
||||
color #777
|
||||
|
||||
Reference in New Issue
Block a user