Skip to content

Commit 34f6f98

Browse files
author
haolin3
committed
add theme
1 parent 94c6b8f commit 34f6f98

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+6260
-40
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"devDependencies": {
1010
"algoliasearch": "^4.2.0",
1111
"vuepress": "^1.4.1",
12-
"vuepress-theme-reco": "^1.4.5",
1312
"vuepress-plugin-autobar": "github:boboidream/vuepress-bar"
1413
},
1514
"description": "易懂的算法教程",

website/.vuepress/config.js

Lines changed: 53 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,56 @@
11
module.exports = {
2-
title: "小浩算法",
3-
plugins: [require('../../lib/autobar.js'), require('../../lib/Notification.js')],
4-
description: '和小浩一起学算法',
5-
// root : "./hell-algorithm",
6-
theme: "reco",
7-
themeConfig: {
8-
logo: '/logo.png',
9-
sidebar: "auto",
10-
searchPlaceholder: "搜索:KMP",
11-
nav: [
12-
{text: 'GitHub', link: 'https://github.com/geekxh/hello-algorithm', icon: 'reco-github'}
13-
],
14-
head: [
15-
['link', {rel: 'shortcut icon', href: '/favicon.ico'}]
16-
],
17-
type: 'blog',
18-
search: true,
19-
searchMaxSuggestions: 10,
20-
lastUpdated: '文章修订于',
21-
author: '程序员小浩',
22-
authorAvatar: '/code.png',
23-
startYear: '2019',
24-
valineConfig: {
25-
visitor: false,
26-
enable: true,
27-
placeholder: "留下你的问题,或者你想要的资源...",
28-
avatar: "wavatar",
29-
requiredFields: ['nick'],
30-
appId: 'sINkW5sfpPxoqDyBqbpvTN79-gzGzoHsz',
31-
appKey: '5tkDVulRNyjuAbCUekxU6zHW',
2+
title: "和小浩学编程",
3+
plugins: [
4+
require('../../lib/autobar.js'),
5+
require('../../lib/Notification.js')],
6+
description: '编程是一件有趣的事情',
7+
// root : "./hell-algorithm",
8+
theme: "reco",
9+
themeConfig: {
10+
logo: '/logo.png',
11+
sidebar: "auto",
12+
searchPlaceholder: "搜索:KMP",
13+
nav: [
14+
{
15+
text: 'GitHub',
16+
link: 'https://githubd.com/geekxh/hello-algorithm',
17+
icon: 'reco-github'
18+
},
19+
{
20+
text: 'TimeLine',
21+
link: '/timeline/',
22+
icon: 'reco-date'
23+
}
24+
],
25+
// 博客配置
26+
blogConfig: {
27+
tag: {
28+
___location: 3, // 在导航栏菜单中所占的位置,默认3
29+
text: 'Tag' // 默认文案 “标签”
30+
}
31+
},
32+
head: [
33+
['link', {rel: 'shortcut icon', href: '/favicon.ico'}]
34+
],
35+
type: 'blog',
36+
search: true,
37+
searchMaxSuggestions: 10,
38+
lastUpdated: '文章修订于',
39+
author: '程序员小浩',
40+
authorAvatar: '/code.png',
41+
startYear: '2019',
42+
valineConfig: {
43+
visitor: false,
44+
enable: true,
45+
placeholder: "留下你的问题,或者你想要的资源...",
46+
avatar: "wavatar",
47+
requiredFields: ['nick'],
48+
appId: 'sINkW5sfpPxoqDyBqbpvTN79-gzGzoHsz',
49+
appKey: '5tkDVulRNyjuAbCUekxU6zHW',
50+
},
51+
noFoundPageByTencent: false
3252
},
33-
noFoundPageByTencent: false
34-
},
35-
markdown: {
36-
lineNumbers: true,
37-
}
53+
markdown: {
54+
lineNumbers: true,
55+
}
3856
}

website/.vuepress/theme/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 reco_luan
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

website/.vuepress/theme/README.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<p align="center"><a href="https://vuejs.org" target="_blank" rel="noopener noreferrer"><img width="150" src="https://i.loli.net/2020/01/13/TPKA1wp6s4ufSm2.png" alt="Vue logo"></a></p>
2+
3+
<p align="center">
4+
<img src="https://img.shields.io/badge/leancloud--storage-3.13.0-orange.svg">
5+
<img src="https://img.shields.io/badge/valine-1.3.6-blue.svg">
6+
<img src="https://img.shields.io/badge/vue--click--outside-1.0.7-blue.svg">
7+
8+
</p>
9+
10+
## Introduce
11+
12+
1. 这是一个vuepress主题,旨在添加博客所需的分类、标签墙、分页、评论等功能;
13+
2. 主题追求极简,根据 vuepress 的默认主题修改而成,官方的主题配置仍然适用;
14+
3. 效果:[午后南杂](https://www.recoluan.com)
15+
4. 文档:[vuepress-theme-reco-doc](https://vuepress-theme-reco.recoluan.com)
16+
17+
## Quick start
18+
19+
**npx**
20+
21+
```
22+
npx @vuepress-reco/theme-cli init my-blog
23+
```
24+
25+
**npm**
26+
27+
```bash
28+
# init
29+
npm install @vuepress-reco/theme-cli -g
30+
theme-cli init my-blog
31+
32+
# install
33+
cd my-blog
34+
npm install
35+
36+
# run
37+
npm run dev
38+
39+
# build
40+
npm run build
41+
```
42+
43+
**yarn**
44+
45+
```bash
46+
# init
47+
yarn global add @vuepress-reco/theme-cli
48+
theme-cli init my-blog
49+
50+
# install
51+
cd my-blog
52+
yarn install
53+
54+
# run
55+
yarn dev
56+
57+
# build
58+
yarn build
59+
```
60+
61+
## Preview
62+
63+
![size.png](https://i.loli.net/2020/01/13/nCbXp13lRG2TNeD.png)
64+
65+
![style.png](https://i.loli.net/2020/01/13/ke1VirShQRLnEd7.png)
66+
67+
![dark.png](https://i.loli.net/2020/01/13/Lj6XbwdmDFCYH9k.png)
68+
69+
![home.png](https://i.loli.net/2020/01/13/nra3kbYSlxojmw4.png)
70+
71+
## Contributors
72+
73+
**衷心感谢为此项目贡献过宝贵代码的朋友们**
74+
75+
|昵称|贡献记录|
76+
|:-:|-|
77+
|[kangxu](https://github.com/kangxukangxu)|[[email protected]](https://github.com/recoluan/vuepress-theme-reco/commit/ec7426a88d50cf8d9f90a7ad9b731a10da7f438b)|
78+
|[Ekko](https://github.com/danranVm)|[[email protected]](https://github.com/recoluan/vuepress-theme-reco-demo/commit/6d2bbe919e7f6564b8c8173558d197e38e024dc5)|
79+
80+
**衷心感谢美女设计师**
81+
82+
|昵称|贡献内容|
83+
|:-:|-|
84+
|[Zoey]()|主题图标调整定稿|
85+
|冰冰|主题图标初稿|
86+
87+
## License
88+
[MIT](https://github.com/recoluan/vuepress-theme-reco/blob/master/LICENSE)
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
<template>
2+
<form
3+
id="search-form"
4+
class="algolia-search-wrapper search-box"
5+
role="search"
6+
>
7+
<i class="iconfont reco-search"></i>
8+
<input
9+
id="algolia-search-input"
10+
class="search-query"
11+
:placeholder="placeholder"
12+
>
13+
</form>
14+
</template>
15+
16+
<script>
17+
export default {
18+
props: ['options'],
19+
data () {
20+
return {
21+
placeholder: undefined
22+
}
23+
},
24+
mounted () {
25+
this.initialize(this.options, this.$lang)
26+
this.placeholder = this.$site.themeConfig.searchPlaceholder || ''
27+
},
28+
29+
methods: {
30+
initialize (userOptions, lang) {
31+
Promise.all([
32+
import(/* webpackChunkName: "docsearch" */ 'docsearch.js/dist/cdn/docsearch.min.js'),
33+
import(/* webpackChunkName: "docsearch" */ 'docsearch.js/dist/cdn/docsearch.min.css')
34+
]).then(([docsearch]) => {
35+
docsearch = docsearch.default
36+
const { algoliaOptions = {}} = userOptions
37+
docsearch(Object.assign(
38+
{},
39+
userOptions,
40+
{
41+
inputSelector: '#algolia-search-input',
42+
// #697 Make docsearch work well at i18n mode.
43+
algoliaOptions: Object.assign({
44+
'facetFilters': [`lang:${lang}`].concat(algoliaOptions.facetFilters || [])
45+
}, algoliaOptions),
46+
handleSelected: (input, event, suggestion) => {
47+
const { pathname, hash } = new URL(suggestion.url)
48+
this.$router.push(`${pathname}${hash}`)
49+
}
50+
}
51+
))
52+
})
53+
},
54+
55+
update (options, lang) {
56+
this.$el.innerHTML = '<input id="algolia-search-input" class="search-query">'
57+
this.initialize(options, lang)
58+
}
59+
},
60+
61+
watch: {
62+
$lang (newValue) {
63+
this.update(this.options, newValue)
64+
},
65+
66+
options (newValue) {
67+
this.update(newValue, this.$lang)
68+
}
69+
}
70+
}
71+
</script>
72+
73+
<style lang="stylus">
74+
@require '../styles/mode.styl'
75+
.algolia-search-wrapper
76+
& > span
77+
vertical-align middle
78+
.algolia-autocomplete
79+
line-height normal
80+
.ds-dropdown-menu
81+
background-color var(--background-color)
82+
border-radius $borderRadius
83+
font-size 15px
84+
margin 6px 0 0
85+
padding 4px
86+
text-align left
87+
box-shadow var(--box-shadow)
88+
&:before
89+
display none
90+
[class*=ds-dataset-]
91+
background-color var(--background-color)
92+
border none
93+
padding 0
94+
.ds-suggestions
95+
margin-top 0
96+
.ds-suggestion
97+
border-bottom 1px solid var(--border-color)
98+
.algolia-docsearch-suggestion--highlight
99+
color $accentColor
100+
.algolia-docsearch-suggestion
101+
border-color var(--border-color)
102+
padding 0
103+
.algolia-docsearch-suggestion--category-header
104+
padding 5px 10px
105+
margin-top 0
106+
background $accentColor
107+
color #fff
108+
font-weight 600
109+
.algolia-docsearch-suggestion--highlight
110+
background rgba(255, 255, 255, 0.6)
111+
.algolia-docsearch-suggestion--wrapper
112+
background var(--background-color)
113+
padding 0
114+
.algolia-docsearch-suggestion--title
115+
font-weight 600
116+
margin-bottom 0
117+
color var(--text-color)
118+
.algolia-docsearch-suggestion--subcategory-column
119+
vertical-align top
120+
padding 5px 7px 5px 5px
121+
border-color var(--border-color)
122+
background var(--background-color)
123+
&:after
124+
display none
125+
.algolia-docsearch-suggestion--subcategory-column-text
126+
color var(--text-color)
127+
.algolia-docsearch-footer
128+
border-color var(--border-color)
129+
background var(--background-color)
130+
.ds-cursor .algolia-docsearch-suggestion--content
131+
background-color #e7edf3 !important
132+
color $textColor
133+
134+
@media (min-width: $MQMobile)
135+
.algolia-search-wrapper
136+
.algolia-autocomplete
137+
.algolia-docsearch-suggestion
138+
.algolia-docsearch-suggestion--subcategory-column
139+
float none
140+
width 150px
141+
min-width 150px
142+
display table-cell
143+
.algolia-docsearch-suggestion--content
144+
float none
145+
display table-cell
146+
width 100%
147+
vertical-align top
148+
.ds-dropdown-menu
149+
min-width 515px !important
150+
151+
@media (max-width: $MQMobile)
152+
.algolia-search-wrapper
153+
.ds-dropdown-menu
154+
min-width calc(100vw - 4rem) !important
155+
max-width calc(100vw - 4rem) !important
156+
.algolia-docsearch-suggestion--wrapper
157+
padding 5px 7px 5px 5px !important
158+
.algolia-docsearch-suggestion--subcategory-column
159+
padding 0 !important
160+
background var(--border-color) !important
161+
.algolia-docsearch-suggestion--subcategory-column-text:after
162+
content " > "
163+
font-size 10px
164+
line-height 14.4px
165+
display inline-block
166+
width 5px
167+
margin -3px 3px 0
168+
vertical-align middle
169+
170+
</style>

0 commit comments

Comments
 (0)