diff --git a/gulpfile.js b/gulpfile.js index ee16be2..bc7c33d 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -26,20 +26,20 @@ var production = process.env.NODE_ENV === 'production'; var config = { destination: './public', scripts: { - source: './src/js/main.js', + source: './src/main.js', destination: './public/js/', extensions: ['.jsx'], filename: 'bundle.js' }, templates: { - source: './src/jade/*.jade', - watch: './src/jade/*.jade', + source: './src/*.jade', + watch: './src/*.jade', destination: './public/', revision: './public/**/*.html' }, styles: { - source: './src/stylus/style.styl', - watch: './src/stylus/*.styl', + source: './src/style.styl', + watch: './src/**/*.styl', destination: './public/css/' }, assets: { diff --git a/src/js/utils/__tests__/renderer.js b/src/components/repository/__tests__/renderer.js similarity index 95% rename from src/js/utils/__tests__/renderer.js rename to src/components/repository/__tests__/renderer.js index 3f69cee..c46aca3 100644 --- a/src/js/utils/__tests__/renderer.js +++ b/src/components/repository/__tests__/renderer.js @@ -1,5 +1,5 @@ /* globals beforeEach, describe, it */ -import {render} from '../renderer'; +import {render} from '../'; import {expect} from 'chai'; const REPO_DATA = { diff --git a/src/components/repository/index.js b/src/components/repository/index.js new file mode 100644 index 0000000..9317029 --- /dev/null +++ b/src/components/repository/index.js @@ -0,0 +1,28 @@ + +export function render(repository, commits) { + const $commits = commits.map(commit => { + return ` +
  • + + ${commit.message.replace(/\n/g, '
    ')} + +

    + + ${commit.committer.name} + +
  • `; + }); + + return ` +
    +

    ${repository.description}

    +

    + ${repository.full_name} +

    + +
    + `; +} + diff --git a/src/stylus/style.styl b/src/components/repository/index.styl similarity index 54% rename from src/stylus/style.styl rename to src/components/repository/index.styl index a389d9d..e733b92 100644 --- a/src/stylus/style.styl +++ b/src/components/repository/index.styl @@ -1,23 +1,17 @@ -body, html - margin 0 - padding 1em - font 14px/1.4 'Helvetica Neue', Helvetica, Arial - color #333 +.repository__title + margin-bottom 0 -li +.repository__description + margin-top 0 + +.repository__commits + margin-top 2em + +.commit 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 + diff --git a/src/jade/index.jade b/src/index.jade similarity index 100% rename from src/jade/index.jade rename to src/index.jade diff --git a/src/js/utils/renderer.js b/src/js/utils/renderer.js deleted file mode 100644 index 52dc665..0000000 --- a/src/js/utils/renderer.js +++ /dev/null @@ -1,20 +0,0 @@ - -export function render(repository, commits) { - const $commits = commits.map(commit => { - return ` -
  • - ${commit.message.replace(/\n/g, '
    ')} -

    - ${commit.committer.name} -
  • `; - }); - - return ` -

    ${repository.description}

    -

    - ${repository.full_name} -

    - - `; -} - diff --git a/src/js/main.js b/src/main.js similarity index 81% rename from src/js/main.js rename to src/main.js index 41e9918..a2c72f4 100644 --- a/src/js/main.js +++ b/src/main.js @@ -1,7 +1,7 @@ 'use strict'; import {getCommits, getRepo} from './services/github'; -import {render} from './utils/renderer'; +import {render} from './components/repository'; Promise.all([getRepo(), getCommits()]) .then(([repository, commits]) => { diff --git a/src/js/services/github.js b/src/services/github.js similarity index 100% rename from src/js/services/github.js rename to src/services/github.js diff --git a/src/style.styl b/src/style.styl new file mode 100644 index 0000000..32ba096 --- /dev/null +++ b/src/style.styl @@ -0,0 +1,7 @@ +body, html + margin 0 + padding 1em + font 14px/1.4 'Helvetica Neue', Helvetica, Arial + color #333 + +@import './components/repository'