Skip to content

Commit

Permalink
feat: init
Browse files Browse the repository at this point in the history
  • Loading branch information
HuangXiZhou committed May 14, 2018
0 parents commit c90a047
Show file tree
Hide file tree
Showing 30 changed files with 910 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.DS_Store
.vscode/
node_modules/
.idea
*.iml
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2018-present, TB

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# theme-github-simple

An official theme designed for TB.

<p align="center">
<a href="https://github.com/TB-blog/theme-github-simple" target="_blank">
<img src="screenshot.png" width="700px">
<br>
Source code
</a>
</p>

## Build Setup

Requires Node.js 8+

```bash
# generate your blog project
tb init [project-name]

# chooese theme-geek-morning
? Chooese a theme you want:
❯ theme-github-simple

# enter [project]
cd [project-name]

# install dependencies
npm install # or yarn

# serve in dev mode, with hot reload at localhost:8080
npm run dev

# build for production
npm run build

# serve in production mode
npm start
```

## Source theme

[Mirror](https://github.com/LoeiFy/Mirror)

## License

[MIT](LICENSE)
26 changes: 26 additions & 0 deletions layout/index.template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>{{ title }}</title>
<meta charset="utf-8">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<link rel="apple-touch-icon" sizes="120x120" href="../source/public/icons/logo-120.png">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,minimum-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="shortcut icon" sizes="48x48" href="../source/public/icons/logo-48.png">
<meta name="theme-color" content="##1d1f21">
<link rel="manifest" href="../manifest.json">
<link href="//at.alicdn.com/t/font_664639_o2hp73rc913v7vi.css" rel="stylesheet">
<link href="https://unpkg.com/gitalk/dist/gitalk.css" rel="stylesheet">
<style>
#skip a { position:absolute; left:-10000px; top:auto; width:1px; height:1px; overflow:hidden; }
#skip a:focus { position:static; width:auto; height:auto; }
</style>
</head>
<body>
<div id="skip"><a href="#app">skip to content</a></div>
<!--vue-ssr-outlet-->
</body>
</html>
28 changes: 28 additions & 0 deletions layout/src/App.template.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<template>
<div id="app">
<header v-if="!this.$route.fullPath.match('item')" class="header">
<a class="avatar" :href="this.$store.state.user.html_url" target="_blank" rel="noopener">
<img :src="this.$store.state.user.avatar_url" alt="avatar">
</a>
<h1 class="username">{{ this.$store.state.user.name }}</h1>
<p class="bio">{{ this.$store.state.user.bio }}</p>
<div class="social">
<router-link to="/blog">
<i class="iconfont icon-blog"></i>
</router-link>
<router-link to="/repo">
<i class="iconfont icon-github"></i>
</router-link>
<a :href="this.$store.state.user.blog" target="_blank" rel="noopener">
<i class="iconfont icon-home"></i>
</a>
<a :href="`mailto:${this.$store.state.user.email}`">
<i class="iconfont icon-email"></i>
</a>
</div>
</header>
<transition name="fade" mode="out-in">
<router-view class="view"></router-view>
</transition>
</div>
</template>
12 changes: 12 additions & 0 deletions layout/src/ErrorView.template.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<template>
<div class="error-view">
<h1>{{ code }}</h1>
<p v-if="code === '404'" class="msg">Looks like you're looking for a page that doesn't exist. Or a page I might have just deleted. Either way,
<router-link to="/">go to home page</router-link>
or be sure to check the url, your spelling and try again.
</p>
<p v-else class="msg">
Whoops! Service error...
</p>
</div>
</template>
48 changes: 48 additions & 0 deletions layout/src/ItemList.template.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<template>
<div class="list-view" :class="{ 'repos-view': type === 'repo' }">
<div v-if="type === 'blog'" class="list-nav">
<router-link class="btn-page" v-if="page > 1" :to="'/' + type + '/' + (page - 1)">PREV</router-link>
<router-link class="btn-page" v-if="hasMore" :to="'/' + type + '/' + (page + 1)">NEXT</router-link>
</div>
<template v-if="displayedItems.length">
<transition :name="transition">
<div class="list" :key="displayedPage" v-if="displayedPage > 0">
<transition-group tag="ul" name="item">
<item v-for="item in displayedItems" :key="item.id" :item="item" :type="type">
</item>
</transition-group>
</div>
</transition>
</template>
<template v-else-if="!displayedItems.length && page <= maxPage">
<div class="empty-item">
<h1>Congratulations!</h1>
You launched
<a href="https://github.com/TB-blog/TB" target="_blank" rel="noopener">TB</a> successfully,
but it looks like you have not yet created a new issue.
If you are the admin, please click
<a :href="`https://github.com/${this.$_config.user}/${this.$_config.repo}/issues/new`" target="_blank" rel="noopener">here</a>
to start.<br>
If you created a new issue successfully,
please use <code>Ctrl C</code> and <code>tb run</code> or <code>tb deploy</code> to reload TB.
</div>
</template>
<template v-else>
<div class="empty-item">
<h1>Sorry...</h1>
There is nothing, you can click
<a :href="`https://github.com/${this.$_config.user}`" target="_blank" rel="noopener">here</a>
to check my Github profile and have a reset.
</div>
</template>
<template v-if="!displayedItems.length && type === 'repo' && page <= maxPage">
<div class="empty-issue">
<h1>Sorry...</h1>
There is no repository, you can click
<a :href="`https://github.com/${this.$_config.user}`" target="_blank" rel="noopener">here</a>
to check my profile or see my
<router-link to="/blog">blogs</router-link>.
</div>
</template>
</div>
</template>
46 changes: 46 additions & 0 deletions layout/src/ItemView.template.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<style lang="stylus">
@import '../../source/style/ItemView.styl';
</style>

<template>
<div class="item-view" v-if="item">
<template v-if="item">
<div class="item-view-header">
<div class="back">
<i @click="back" class="iconfont icon-back"></i>
</div>
<h1>{{ item.title }}</h1>
<p class="meta">
Post By
<a :href="`https://github.com/${this.$_config.user}`" target="_blank" rel="noopener">
{{this.$_config.nickname}}
</a>
{{ item.created_at | timeAgo }}
</p>
</div>
<div v-if="item.body" class="content" v-html="htmlResource" v-highlight></div>
<div class="item-view-footer">
<span v-if="item.labels" class="labels" v-for="label in item.labels" :key="label.id">
<a :href="labelUrl + label.name"
target="_blank"
rel="noopener">#{{ label.name }}</a>
</span>
<p class="meta">
Updated {{ item.updated_at | timeAgo }}
</p>
</div>
<div v-if="this.$_config.gitalk.useGitalk" id="item-view-comments"></div>
</template>
</div>
</template>

<script>
import 'highlight.js/styles/github.css';
export default {
methods: {
back () {
this.$router.go(-1);
}
}
}
</script>
36 changes: 36 additions & 0 deletions layout/src/components/Item.template.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<template>
<li class="blogs-item" :class="{ 'list-item-left': type === 'blog' }">
<div class="post">
<span class="score">{{ item.stargazers_count }}</span>
<span class="title">
<template v-if="type === 'blog'">
<a rel="noopener">{{ item.title }}</a>
</template>
<template v-else>
<a :href="`https://github.com/${this.$_config.user}/` + item.name" target="_blank" rel="noopener">
{{ item.name }}
</a>
</template>
</span>
<br>
<span class="meta">
<template v-if="type === 'blog'">
<span class="time">
{{ item.created_at | timeFormat }}
</span>
<span>
| <router-link :to="'/item/' + item.number">{{ item.descendants }} Read more</router-link>
</span>
</template>
<template v-else>
<span class="time">
{{ item.description }}
</span><br>
<span v-if="item.license" class="time">
{{ item.license.name }}
</span>
</template>
</span>
</div>
</li>
</template>
37 changes: 37 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "TB Blog",
"short_name": "TB",
"icons": [{
"src": "./theme/theme-geek-dark/source/public/icons/logo-120.png",
"sizes": "120x120",
"type": "image/png"
}, {
"src": "./theme/theme-geek-dark/source/public/icons/logo-144.png",
"sizes": "144x144",
"type": "image/png"
}, {
"src": "./theme/theme-geek-dark/source/public/icons/logo-152.png",
"sizes": "152x152",
"type": "image/png"
}, {
"src": "./theme/theme-geek-dark/source/public/icons/logo-192.png",
"sizes": "192x192",
"type": "image/png"
}, {
"src": "./theme/theme-geek-dark/source/public/icons/logo-256.png",
"sizes": "256x256",
"type": "image/png"
}, {
"src": "./theme/theme-geek-dark/source/public/icons/logo-384.png",
"sizes": "384x384",
"type": "image/png"
}, {
"src": "./theme/theme-geek-dark/source/public/icons/logo-512.png",
"sizes": "512x512",
"type": "image/png"
}],
"start_url": "/",
"background_color": "#1d1f21",
"display": "standalone",
"theme_color": "#1d1f21"
}
51 changes: 51 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c90a047

Please sign in to comment.