diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..84b7cce --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 reco_luan + +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. diff --git a/Layout.vue b/Layout.vue index 5a519d1..f35ac29 100644 --- a/Layout.vue +++ b/Layout.vue @@ -19,14 +19,16 @@ - + - + + + @@ -39,14 +41,17 @@ import Page from "./pages/Page/"; import Sidebar from "./components/Sidebar/"; import SWUpdatePopup from "./components/SWUpdatePopup/"; import { resolveSidebarItems } from "./util/" +import BackToTop from "./components/BackToTop/" +import Valine from './components/Valine/' export default { - components: { Home, Page, Sidebar, Navbar, SWUpdatePopup }, + components: { Home, Page, Sidebar, Navbar, SWUpdatePopup, BackToTop, Valine }, data() { return { isSidebarOpen: false, - swUpdateEvent: null + swUpdateEvent: null, + valineRefresh: false }; }, @@ -117,18 +122,15 @@ export default { }); this.$on("sw-updated", this.onSWUpdated); - - const { themeConfig } = this.$site; - - if (!(themeConfig.showParticles != undefined && !themeConfig.showParticles)) { - localStorage.setItem('particle', JSON.stringify(themeConfig.particlesConfig || {})) - var script = document.createElement('script') - script.src = 'https://blog-static.cnblogs.com/files/luanhewei/particle.js' - document.querySelector('body').appendChild(script) - } }, methods: { + tagChange () { + this.valineRefresh = true + setTimeout(() => { + this.valineRefresh = false + }, 300) + }, toggleSidebar(to) { this.isSidebarOpen = typeof to === "boolean" ? to : !this.isSidebarOpen; }, @@ -162,3 +164,4 @@ export default { + diff --git a/README.md b/README.md index 1d041b1..690ecb7 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,32 @@ # vuepress-theme-reco -> 1. This is a vuepress theme aimed at adding the categories, TAB walls, pagination, comments and other features required for blogging;
-> 2. The theme itself is minimalist and is modified based on the default theme of the vuepress.
+![vuepress](https://img.shields.io/badge/vuepress-0.14.8-brightgreen.svg) +![leancloud-storage](https://img.shields.io/badge/leancloud--storage-3.10.1-orange.svg) +![valine](https://img.shields.io/badge/valine-1.3.4-blue.svg) + +> 1. It's a vuepress theme aimed at adding the categories, TAB walls, pagination, comments and other features required for blogging, suitable for `vuepress 0.x`;
+> 2. The theme itself is minimalist and is modified based on the default theme of the vuepress;
> 3. You can open https://recoluan.gitlab.io to see it. ## Preview -#### Home Page -![home.png](https://upload-images.jianshu.io/upload_images/4660406-becd33be1de7391c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) +### Home Page +![home.png](https://upload-images.jianshu.io/upload_images/4660406-0bf9d91e9d289f75.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) -#### Categories Page -![category.png](https://upload-images.jianshu.io/upload_images/4660406-acdd68dfa730e5a8.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) +### Categories Page +![category.png](https://upload-images.jianshu.io/upload_images/4660406-8c7995d750c58536.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) -#### Tags page -![tag.png](https://upload-images.jianshu.io/upload_images/4660406-d3b1ec44b870fbd6.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) +### Tags page +![tag.png](https://upload-images.jianshu.io/upload_images/4660406-39c0d47627869e3a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) -#### Article Page -![article.png](https://upload-images.jianshu.io/upload_images/4660406-00303788bc2edcaa.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) +### Article Page +![article.png](https://upload-images.jianshu.io/upload_images/4660406-a19cad487991409d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) + +### Mobile +![m.png](https://upload-images.jianshu.io/upload_images/4660406-7e2c78c48dd78284.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ## Installation and use @@ -192,45 +199,44 @@ module.exports = { } ``` -2. If you don't like the particle effect, you can turn it off. If you like it, you can also set the count and color of particles. +2. You can add icon to the navigation menu,like this: ```javascript -module.exports = { - title: "午后南杂", - theme: 'reco', - themeConfig: { - // particles - showParticles: true, - // particlesConfig - particlesConfig: { - color: '0, 0, 0', //color of lines, default: '0,0,0'; RGB values: (R,G,B).(note: use ',' to separate.) - pointColor: '0, 0, 0', //color of points, default: '0,0,0'; RGB values: (R,G,B).(note: use ',' to separate.) - opacity: 0.5, // the opacity of line (0~1), default: 0.5. - count: 60, // the number of lines, default: 66. - zIndex: -1, // z-index property of the background, default: -1. - }, - } -} -``` - -3. If you want to click the tags in the list, you can set themeConfig's value of tagClick true - -```javascript -module.exports = { - title: "午后南杂", - theme: 'reco', - themeConfig: { - // whether you can click the tags in the list - tagClick: true, - } -} +{ text: 'Tags', link: '/tags/', icon: 'reco-tag' } ``` +The project has built-in icons for you to choose + +![icon.png](https://upload-images.jianshu.io/upload_images/4660406-565b8ffd891b9cb3.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) + +3. Sets the global author name + +```javascript +module.exports = { + themeConfig: { + // author + author: 'reco_luan', + } +} +``` + +4. Set the author name for a single article + +```bash +--- +title: 你还没真的努力过,就轻易输给了懒惰 +date: 2015-04-23 11:21 +categories: article +author: 渡渡 +--- +``` + + ## Home Config 1. If your heroImage has your website title, maybe you need to set the value of `isShowTitleInHome` `false` to make title not show -``` +```bash # this is your homepage --- @@ -242,7 +248,7 @@ isShowTitleInHome: false 2. If you want change heroImage's style, you can set the value of `heroImageStyle` to achieve the effec you want -``` +```bash # this is your homepage --- @@ -257,3 +263,18 @@ heroImageStyle: { } --- ``` + +3. Home page footer can no longer be edited at will, only the owner's name can be changed. The global author name will be displayed first, and if not, the title of the blog will be displayed + + +## Donate +If you are enjoying this project, please consider making a donation to keep it alive, I will try my best to dedicate more time to work on it. 😉 + +| Alipay | Wechat | +| :------: | :------: | +| ![Alipay.png](https://upload-images.jianshu.io/upload_images/4660406-43aff22cc8a5a4b1.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/240)|![WeChat.png](https://upload-images.jianshu.io/upload_images/4660406-58cfd94e92e60c48.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/240)| + +If you are not available for this, simply spreading the word for me would help too! + +## License +[MIT](https://github.com/recoluan/vuepress-theme-reco/blob/master/LICENSE) diff --git a/components/BackToTop/index.vue b/components/BackToTop/index.vue new file mode 100644 index 0000000..8cb87cb --- /dev/null +++ b/components/BackToTop/index.vue @@ -0,0 +1,110 @@ + + + + + \ No newline at end of file diff --git a/components/Category/index.vue b/components/Category/index.vue index b591479..76f93ea 100644 --- a/components/Category/index.vue +++ b/components/Category/index.vue @@ -76,7 +76,7 @@ export default { @media (max-width: $MQMobile) .categories-wrapper - padding: 0 0.6rem; + padding: 0 1rem; .page-edit .edit-link margin-bottom .5rem diff --git a/components/NavLink/index.vue b/components/NavLink/index.vue index 3a47b33..e4814bf 100644 --- a/components/NavLink/index.vue +++ b/components/NavLink/index.vue @@ -3,14 +3,19 @@ class="nav-link" :to="{path: link}" v-if="!isExternal(link)" - :exact="exact">{{ item.text }} + :exact="exact"> + + {{ item.text }} + - {{ item.text }} + + {{ item.text }} + diff --git a/components/NavLinks/components/DropdownLink/index.vue b/components/NavLinks/components/DropdownLink/index.vue index a8d527f..bf997cd 100644 --- a/components/NavLinks/components/DropdownLink/index.vue +++ b/components/NavLinks/components/DropdownLink/index.vue @@ -5,7 +5,10 @@ - {{ item.text }} + + + {{ item.text }} + @@ -93,7 +96,7 @@ export default { padding 0 list-style none .dropdown-subitem - font-size 0.9em + font-size 0.9rem a display block line-height 1.7rem @@ -102,6 +105,7 @@ export default { font-weight 400 margin-bottom 0 padding 0 1.5rem 0 1.25rem + font-size .9rem &:hover color $accentColor &.router-link-active @@ -162,7 +166,7 @@ export default { position absolute top 100% right 0 - background-color #fff + background-color $bgColor padding 0.6rem 0 text-align left border-radius 0.25rem diff --git a/components/NavLinks/index.vue b/components/NavLinks/index.vue index 5435a84..f982a36 100644 --- a/components/NavLinks/index.vue +++ b/components/NavLinks/index.vue @@ -116,10 +116,12 @@ export default { .nav-links display inline-block a - line-height 1.4rem + line-height 1.6rem color inherit &:hover, &.router-link-active color $accentColor + .iconfont + color $accentColor!important .nav-item position relative display inline-block diff --git a/components/Navbar/components/SidebarButton/index.vue b/components/Navbar/components/SidebarButton/index.vue index 080a811..362b2db 100644 --- a/components/Navbar/components/SidebarButton/index.vue +++ b/components/Navbar/components/SidebarButton/index.vue @@ -1,8 +1,6 @@ @@ -10,17 +8,15 @@ @import '../../../../styles/config.styl' .sidebar-button - display none - width 1.25rem - height 1.25rem - position absolute - padding 0.6rem - top 0.6rem - left 1rem - .icon - display block - width 1.25rem - height 1.25rem + display: none; + width: 1.8rem; + height: 1.8rem; + position: absolute; + padding: 0.8rem; + top: 0; + right: 0; + i + font-size 1.8rem @media (max-width: $MQMobile) .sidebar-button diff --git a/components/Navbar/index.vue b/components/Navbar/index.vue index 3ec0524..c1d6ce1 100644 --- a/components/Navbar/index.vue +++ b/components/Navbar/index.vue @@ -7,21 +7,17 @@ class="logo" v-if="$site.themeConfig.logo" :src="$withBase($site.themeConfig.logo)" - :alt="$siteTitle" - > + :alt="$siteTitle"> {{ $siteTitle }} + v-if="$siteTitle">{{ $siteTitle }} @@ -29,12 +25,11 @@ + + diff --git a/components/SWUpdatePopup/index.vue b/components/SWUpdatePopup/index.vue index d3095c3..00b9890 100644 --- a/components/SWUpdatePopup/index.vue +++ b/components/SWUpdatePopup/index.vue @@ -67,7 +67,7 @@ export default { padding 1em border 1px solid $accentColor border-radius 3px - background #fff + background-color: $bgColor; box-shadow 0 4px 16px rgba(0, 0, 0, 0.5) text-align center diff --git a/components/Search/AlgoliaSearchBox/index.vue b/components/Search/AlgoliaSearchBox/index.vue index 9a16098..5c62d52 100644 --- a/components/Search/AlgoliaSearchBox/index.vue +++ b/components/Search/AlgoliaSearchBox/index.vue @@ -65,7 +65,7 @@ export default { .algolia-autocomplete line-height normal .ds-dropdown-menu - background-color #fff + background-color $bgColor border 1px solid #999 border-radius 4px font-size 16px diff --git a/components/Search/SearchBox/images/search.svg b/components/Search/SearchBox/images/search.svg deleted file mode 100644 index 03d8391..0000000 --- a/components/Search/SearchBox/images/search.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/components/Search/SearchBox/index.vue b/components/Search/SearchBox/index.vue index d01b428..ec33a81 100644 --- a/components/Search/SearchBox/index.vue +++ b/components/Search/SearchBox/index.vue @@ -1,5 +1,5 @@ - diff --git a/styles/common.styl b/styles/common.styl new file mode 100644 index 0000000..dce5154 --- /dev/null +++ b/styles/common.styl @@ -0,0 +1,178 @@ +/* 左浮动 */ + +.float-left { + float: left; +} + +/* 有浮动 */ + +.float-right { + float: right; +} + +/* 清除浮动 */ + +.clear-fix:after { + content: ' '; + display: block; + height: 0; + clear: both; +} + +/*************显示隐藏*************/ + +/* 显示 */ + +.show { + display: block; +} + +/* 隐藏 */ + +.hide { + display: none; +} + +/*************盒子类型*************/ + +/* block */ + +.block { + display: block; +} + +/* inline */ + +.inline { + display: inline; +} + +/* inline-block */ + +.inline-block { + display: inline-block; +} + +/************** flex布局 **************/ + +/* 父元素 */ + +.flex-wrapper { + display: flex; +} + +/* 换行 */ + +.flex-wrap { + flex-wrap: wrap; +} + +/* 子元素 */ + +.flex-item { + flex: 1; +} + +/* 顺序从上到下 */ + +.flex-direction-column { + flex-direction: column; +} + +/* 顺序从左到右 */ + +.flex-direction-row { + flex-direction: row; +} + +/* 横向居中 */ + +.flex-row-center { + justify-content: center; +} + +/* 纵向居中 */ + +.flex-column-center { + align-items: center; +} + +/* 横向两边对齐,并且第一个元素前和最后一个元素后不留空白 */ + +.flex-space-between { + justify-content: space-between; +} + +/* 横向两边对齐,并且第一个元素前和最后一个元素后留有空白 */ + +.flex-space-around { + justify-content: space-around; +} + +/**************文字位置**************/ + +.text-center { + text-align: center; +} + +.text-left { + text-align: left; +} + +.text-right { + text-align: right; +} + +.overflowView{ + overflow: hidden; +} + +/**************文字溢出省略号**************/ + +.text-overflow { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +/**************文字2行溢出省略号**************/ + +.text-overflowTow { + display: -webkit-box; + overflow: hidden; + text-overflow: ellipsis; + word-wrap: break-word; + white-space: normal !important; + /* -webkit-line-clamp: 2; */ + -webkit-box-orient: vertical; +} + +/**************文字溢出自动换行**************/ + +.text-wrap { + word-wrap: break-word; + word-break: normal; +} + +/**************盒模型**************/ + +.border-box { + box-sizing: border-box; +} + +.content-box { + box-sizing: content-box; +} + +.hide { + display: none; +} +/* 禁止复制 */ +.user-select-no { + user-select: none; +} + +/* 添加悬浮小手标志 */ +.pointer { + cursor: pointer; +} \ No newline at end of file diff --git a/styles/config.styl b/styles/config.styl index b673dee..fc5ddf0 100644 --- a/styles/config.styl +++ b/styles/config.styl @@ -4,9 +4,10 @@ $textColor = #2c3e50 $borderColor = #eaecef $codeBgColor = #282c34 $arrowBgColor = #ccc +$bgColor = #fff // layout -$navbarHeight = 3.6rem +$navbarHeight = 3.4rem $sidebarWidth = 20rem $contentWidth = 740px diff --git a/styles/custom-blocks.styl b/styles/custom-blocks.styl index 3ccc2df..2ad6f8f 100644 --- a/styles/custom-blocks.styl +++ b/styles/custom-blocks.styl @@ -9,18 +9,19 @@ margin 1rem 0 &.tip background-color #f3f5f7 - border-color #42b983 + border-color #67cc86 + color darken(#67cc86, 70%) &.warning - background-color rgba(255,229,100,.3) - border-color darken(#ffe564, 35%) + background-color #fbf0ea + border-color #fb9b5f color darken(#ffe564, 70%) .custom-block-title color darken(#ffe564, 50%) a color $textColor &.danger - background-color #ffe6e6 - border-color darken(red, 20%) + background-color #fceaea + border-color #f26d6d color darken(red, 70%) .custom-block-title color darken(red, 40%) diff --git a/styles/mobile.styl b/styles/mobile.styl index b35e59c..1e2ca9d 100644 --- a/styles/mobile.styl +++ b/styles/mobile.styl @@ -33,5 +33,5 @@ $mobileSidebarWidth = $sidebarWidth * 0.82 font-size 1.9rem .content div[class*="language-"] - margin 0.85rem -1.5rem + margin 0.85rem -1.3rem border-radius 0 diff --git a/styles/theme.styl b/styles/theme.styl index 114a8a7..356a2fa 100644 --- a/styles/theme.styl +++ b/styles/theme.styl @@ -5,17 +5,30 @@ @require './arrow' @require './wrapper' @require './toc' +// @require './common' +@require '../fonts/iconfont.css' html, body padding 0 margin 0 + -moz-user-select:none;/*火狐*/ + -webkit-user-select:none;/*webkit浏览器*/ + -ms-user-select:none;/*IE10*/ + -khtml-user-select:none;/*早期浏览器*/ + user-select:none; + background-color: $bgColor + overflow-x: hidden body font-family -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif -webkit-font-smoothing antialiased -moz-osx-font-smoothing grayscale font-size 16px - color $textColor + color $textColor + +input + background-color: $bgColor + -webkit-appearance: none; .page padding-left $sidebarWidth @@ -27,7 +40,7 @@ body left 0 right 0 height $navbarHeight - background-color #fff + background-color $bgColor box-sizing border-box box-shadow: 0 1px 6px 0 rgba(32,33,36,0.28) @@ -45,7 +58,7 @@ body .sidebar font-size 15px - background-color #fff + background-color $bgColor width $sidebarWidth position fixed z-index 10 @@ -60,7 +73,7 @@ body .content:not(.custom) @extend $wrapper > *:first-child - margin-top $navbarHeight + margin-top 1rem a:hover text-decoration underline p.demo @@ -182,6 +195,32 @@ th, td .custom-layout padding-top 0 +.iconfont + font-size: 0.9rem; + color: #999; + // &:not(:first-child) + // margin-left: 1rem + // span + // margin-left: .5rem + +/************** 滚动条 **************/ +::-webkit-scrollbar + width: 5px; + height: 5px; + +::-webkit-scrollbar-track-piece + background-color: rgba(0, 0, 0, 0.2); + -webkit-border-radius: 6px; + +::-webkit-scrollbar-thumb:vertical + height: 5px; + background-color: rgba(125, 125, 125, 0.7); + -webkit-border-radius: 6px; + +::-webkit-scrollbar-thumb:horizontal + width: 5px; + background-color: rgba(125, 125, 125, 0.7); + -webkit-border-radius: 6px; @media (min-width: ($MQMobile + 1px)) .theme-container.no-sidebar diff --git a/styles/wrapper.styl b/styles/wrapper.styl index a99262c..760ef7a 100644 --- a/styles/wrapper.styl +++ b/styles/wrapper.styl @@ -5,5 +5,5 @@ $wrapper @media (max-width: $MQNarrow) padding 2rem @media (max-width: $MQMobileNarrow) - padding 1.5rem + padding 1.5rem 1rem