Skip to content

Commit

Permalink
refactor: remove header nav
Browse files Browse the repository at this point in the history
  • Loading branch information
YunYouJun committed May 21, 2019
1 parent f7b07b6 commit 2c292d7
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 124 deletions.
6 changes: 0 additions & 6 deletions languages/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,6 @@ counter:
one: 1 post.
other: "%d posts in total."

state:
posts: posts
pages: pages
tags: tags
categories: categories

search:
placeholder: Searching...
algolia_search:
Expand Down
6 changes: 0 additions & 6 deletions languages/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,6 @@ counter:
one: 目前共计 1 篇日志。
other: "目前共计 %d 篇日志。"

state:
posts: 日志
pages: 页面
tags: 标签
categories: 分类

search:
placeholder: 搜索...
algolia_search:
Expand Down
3 changes: 0 additions & 3 deletions layout/_partial/layout.pug
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ html(lang=config.language)
//- global
include ../_third-party/icon.pug
include sidebar.pug
header#site-header
.header-inner
include nav.pug
main#content-outer.sidebar-translate
#content-inner.layout
block content
Expand Down
7 changes: 0 additions & 7 deletions layout/_partial/nav.pug

This file was deleted.

27 changes: 19 additions & 8 deletions layout/_partial/sidebar.pug
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,32 @@ aside#sidebar(class=is_post() ? 'is-post' : '')
.site-desciption!=config.description

nav.site-state
if config.archive_dir != '/' && site.posts.length > 0
.site-state-item
a(href=url_for(theme.menu.home.path), title=__('menu.home'))
span.site-state-item-icon
+icon(theme.menu.home.icon)
if site.posts.length > 0
.site-state-item.site-state-posts
a(href=url_for(config.archive_dir))
a(href=url_for(config.archive_dir), title=__('menu.archives'))
span.site-state-item-icon
+icon(theme.menu.archives.icon)
span.site-state-item-count!=site.posts.length
span.site-state-item-name!=__('state.posts')
if site.categories.length > 0
.site-state-item.site-state-categories
a(href=url_for(config.category_dir))
a(href=url_for(config.category_dir), title=__('menu.categories'))
span.site-state-item-icon
+icon(theme.menu.categories.icon)
span.site-state-item-count!=site.categories.length
span.site-state-item-name!=__('state.categories')
if site.tags.length > 0
.site-state-item.site-state-tags
a(href=url_for(config.tag_dir))
a(href=url_for(config.tag_dir), title=__('menu.tags'))
span.site-state-item-icon
+icon(theme.menu.tags.icon)
span.site-state-item-count!=site.tags.length
span.site-state-item-name!=__('state.tags')
.site-state-item
a.popup-trigger(href='javascript:;', title=__('menu.search'))
span.site-state-item-icon
+icon('icon-search-line')

hr

Expand All @@ -51,7 +62,7 @@ aside#sidebar(class=is_post() ? 'is-post' : '')
span.links-of-author-item
a(href=social.link, title=name, target='_blank', style='color:' + social.color)
+icon(social.icon)

if is_post()
.post-toc-wrap.sidebar-panel.sidebar-panel-active
if toc(page.content).length > 1
Expand Down
40 changes: 14 additions & 26 deletions source/css/_components/scrollbar.styl
Original file line number Diff line number Diff line change
@@ -1,32 +1,20 @@
// scrollbar
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
::-webkit-scrollbar
width: 8px
height: 8px

// track
::-webkit-scrollbar-track {
::-webkit-scrollbar-track
border-radius: 2px
background-color: rgba(0, 0, 0, 0.1)
}
background-color: rgba(0, 0, 0, 0.05)

// Handle style
::-webkit-scrollbar-thumb {
border-radius: 10px;
background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb
border-radius: 2px
background-color: alpha($colors.primary, 0.4)

// inactive style
::-webkit-scrollbar-thumb:window-inactive {
background: rgba(0, 0, 0, 0.1);
}
&:window-inactive
background-color: alpha($colors.primary, 0.2)

// hover style
::-webkit-scrollbar-thumb:hover{
background-color: rgba(0, 0, 0, 0.3);
}
&:hover
background-color: alpha($colors.primary, 0.6)

// active style
::-webkit-scrollbar-thumb:active{
background-color: rgba(0, 0, 0, 0.4);
}
&:active
background-color: alpha($colors.primary, 0.8)
19 changes: 10 additions & 9 deletions source/css/_components/sidebar/site-state.styl
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,23 @@
margin-top: 10px

.site-state-item
display: flex
padding: 0 15px
border-left: 1px solid $light-gray
align-items: center

&:first-child
border-left: none

.site-state-item-icon
color: $dark
line-height: 1
.icon
width: 1.5rem
height: 1.5rem

.site-state-item-count
display: block
text-align: center
color: $dark
font-weight: bold
font-size: 1.2rem

.site-state-item-name
font-size: 0.9rem
color: $dark

.feed-link
margin: 15px 0
font-size: 1rem
6 changes: 0 additions & 6 deletions source/css/_global/index.styl
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
@import "reset.styl"

.layout
margin: 0 80px

+mobile()
margin: 0 10px

// body
// body
// background: radial-gradient(#e6e9f0, #fefefe)
Expand Down
43 changes: 0 additions & 43 deletions source/css/_layout/header.styl

This file was deleted.

5 changes: 5 additions & 0 deletions source/css/_layout/main.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.layout
margin: 0 80px

+mobile()
margin: 0 10px
10 changes: 0 additions & 10 deletions source/js/scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ $(function () {
$('.toc-child').hide()

// main of scroll
// show header
$(window).scroll(throttle(function (event) {
var currentTop = $(this).scrollTop()
// percentage inspired by hexo-theme-next
Expand All @@ -15,12 +14,6 @@ $(function () {
findHeadPosition(currentTop)
var isUp = scrollDirection(currentTop)
if (currentTop > 64) {
if (isUp) {
$('#site-header').hasClass('visible') ? $('#site-header').removeClass('visible') : console.log()
} else {
$('#site-header').hasClass('visible') ? console.log() : $('#site-header').addClass('visible')
}
$('#site-header').addClass('fixed')
if ($('#go-up').css('opacity') === '0') {
$('#go-up').velocity('stop').velocity({
translateX: -30,
Expand All @@ -32,9 +25,6 @@ $(function () {
})
}
} else {
if (currentTop === 0) {
$('#site-header').removeClass('fixed').removeClass('visible')
}
$('#go-up').velocity('stop').velocity({
translateX: 0,
rotateZ: 180,
Expand Down

0 comments on commit 2c292d7

Please sign in to comment.