Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the style of site-nav #1180

Merged
merged 9 commits into from
Oct 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions layout/_macro/sidebar.swig
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
{% macro render(display_toc) %}
<div class="sidebar-toggle">
<div class="sidebar-toggle-line-wrap">
<span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
<span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
<span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
</div>
<div class="toggle sidebar-toggle">
<span class="toggle-line toggle-line-first"></span>
<span class="toggle-line toggle-line-middle"></span>
<span class="toggle-line toggle-line-last"></span>
</div>

<aside class="sidebar">
Expand Down
10 changes: 5 additions & 5 deletions layout/_partials/header/brand.swig
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
</div>

<div class="site-nav-toggle">
<button aria-label="{{ __('accessibility.nav_toggle') }}">
<span class="btn-bar"></span>
<span class="btn-bar"></span>
<span class="btn-bar"></span>
</button>
<div class="toggle" aria-label="{{ __('accessibility.nav_toggle') }}">
<span class="toggle-line toggle-line-first"></span>
<span class="toggle-line toggle-line-middle"></span>
<span class="toggle-line toggle-line-last"></span>
</div>
</div>
</div>
5 changes: 1 addition & 4 deletions source/css/_common/components/post/post-header.styl
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
.posts-expand .post-meta {
color: $grey-dark;
font-family: $font-family-posts;
font-size: $font-size-smallest;
margin: 3px 0 60px 0;
text-align: center;

Expand All @@ -82,10 +83,6 @@
margin: 0 .5em;
}

.post-meta .post-meta-item {
font-size: $font-size-smallest;
}

.post-meta-divider {
margin: 0 .5em;
}
Expand Down
15 changes: 15 additions & 0 deletions source/css/_common/outline/header/menu.styl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@
.fa {
margin-right: 8px;
}

.badge {
display: inline-block;
font-weight: $font-weight-bolder;
line-height: 1;
margin-left: 0.35em;
text-align: center;
white-space: nowrap;

+mobile() {
float: right;
margin-left: 0;
margin-top: 0.35em;
}
}
}

.use-motion .menu-item {
Expand Down
10 changes: 8 additions & 2 deletions source/css/_common/outline/header/site-nav.styl
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@
display: block;
}

button {
.toggle {
background: transparent;
border: 0;
margin-top: 2px;
padding: 9px 10px;
padding: 10px;
width: 22px;

.toggle-line {
background: $text-color;
border-radius: 1px;
}
}
}

Expand Down
18 changes: 1 addition & 17 deletions source/css/_common/outline/sidebar/sidebar-toggle.styl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
cursor: pointer;
height: 14px;
left: $b2t-position-right;
line-height: 0;
padding: 5px;
position: fixed;
width: 14px;
Expand All @@ -20,21 +19,6 @@
}
}

.sidebar-toggle-line {
background: white;
display: inline-block;
height: 2px;
margin-top: 3px;
position: relative;
transition: all .4s;
vertical-align: top;
width: 100%;

&:first-child {
margin-top: 0;
}
}

.sidebar-toggle:hover .sidebar-toggle-line {
.sidebar-toggle:hover .toggle-line {
background: $sidebar-highlight;
}
12 changes: 0 additions & 12 deletions source/css/_common/scaffolding/buttons.styl
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,3 @@
width: (18em / 14);
}
}

.btn-bar {
background: $text-color;
border-radius: 1px;
display: block;
height: 2px;
width: 22px;

+ .btn-bar {
margin-top: 4px;
}
}
1 change: 1 addition & 0 deletions source/css/_common/scaffolding/scaffolding.styl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
@import 'base';
@import 'tables';
@import 'buttons';
@import 'toggles';
@import 'highlight';
@import 'tags';
@import 'pagination';
Expand Down
93 changes: 93 additions & 0 deletions source/css/_common/scaffolding/toggles.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
.toggle {
line-height: 0;

.toggle-line {
background: white;
display: inline-block;
height: 2px;
left: 0px;
margin-top: 3px;
position: relative;
top: 0px;
transition: all .4s;
vertical-align: top;
width: 100%;

&:first-child {
margin-top: 0;
}
}
}

if (hexo-config('sidebar.position') == 'right') {
.toggle.toggle-arrow {
.toggle-line-first {
top: 2px;
transform: rotate(-45deg);
width: 50%;
}

.toggle-line-middle {
width: 90%;
}

.toggle-line-last {
top: -2px;
transform: rotate(45deg);
width: 50%;
}
}

.toggle.toggle-close {
.toggle-line-first {
top: 5px;
transform: rotate(-45deg);
}

.toggle-line-middle {
opacity: 0;
}

.toggle-line-last {
top: -5px;
transform: rotate(45deg);
}
}
} else {
.toggle.toggle-arrow {
.toggle-line-first {
left: 50%;
top: 2px;
transform: rotate(45deg);
width: 50%;
}

.toggle-line-middle {
left: 2px;
width: 90%;
}

.toggle-line-last {
left: 50%;
top: -2px;
transform: rotate(-45deg);
width: 50%;
}
}

.toggle.toggle-close {
.toggle-line-first {
transform: rotate(-45deg);
top: 5px;
}

.toggle-line-middle {
opacity: 0;
}

.toggle-line-last {
transform: rotate(45deg);
top: -5px;
}
}
}
27 changes: 8 additions & 19 deletions source/css/_schemes/Mist/_menu.styl
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,6 @@
margin-top: 5px;
}

.badge {
background-color: white;
border-radius: 10px;
color: $black-light;
display: inline-block;
font-weight: $font-weight-bolder;
line-height: 1;
margin-left: 5px;
padding: 1px 4px;
text-align: center;
text-shadow: 1px 1px 0 rgba(0, 0, 0, .1);
white-space: nowrap;

+mobile() {
float: right;
margin: .35em 0 0 0;
}
}

a, span.exturl {
border-radius: 2px;
padding: 0 10px;
Expand All @@ -70,6 +51,14 @@
@extend .menu-item-active a;
}
}

.badge {
background-color: white;
border-radius: 10px;
color: $black-light;
padding: 1px 4px;
text-shadow: 1px 1px 0 rgba(0, 0, 0, .1);
}
}

a::before {
Expand Down
21 changes: 5 additions & 16 deletions source/css/_schemes/Muse/_menu.styl
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,6 @@
vertical-align: top;
}

.badge {
background-color: $gainsboro;
display: inline-block;
font-weight: $font-weight-bolder;
line-height: 1;
margin-left: 5px;
padding: 1px 4px;
text-align: center;
white-space: nowrap;

+mobile() {
float: right;
margin: .35em 0 0 0;
}
}

a, span.exturl {
+mobile() {
padding: 5px 10px;
Expand All @@ -77,4 +61,9 @@
width: 100%;
}
}

.badge {
background-color: $gainsboro;
padding: 1px 4px;
}
}
10 changes: 1 addition & 9 deletions source/css/_schemes/Pisces/_layout.styl
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,11 @@
box-shadow: $box-shadow-inner;
box-sizing: border-box;
float: right;
min-height: 700px;
padding: $content-desktop-padding;
width: $content-wrap;

+tablet() {
border-radius: initial;
padding: 20px;
width: 100%;
}

+mobile() {
+tablet-mobile() {
border-radius: initial;
min-height: auto;
padding: 20px;
width: 100%;
}
Expand Down
14 changes: 4 additions & 10 deletions source/css/_schemes/Pisces/_menu.styl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
+tablet() {
display: block;
}

.toggle .toggle-line {
background-color: white;
}
}

.site-nav {
Expand Down Expand Up @@ -55,19 +59,9 @@
background-color: $grey-light;
border-radius: 10px;
color: white;
display: inline-block;
float: right;
font-weight: $font-weight-bolder;
line-height: 1;
margin: .35em 0 0 0;
padding: 2px 5px;
text-align: center;
text-shadow: 1px 1px 0 rgba(0, 0, 0, .1);
vertical-align: middle;
white-space: nowrap;
}
}

.btn-bar {
background-color: white;
}
10 changes: 5 additions & 5 deletions source/js/next-boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ NexT.boot.registerEvents = function() {
NexT.utils.registerCanIUseTag();

// Mobile top menu bar.
document.querySelector('.site-nav-toggle button').addEventListener('click', () => {
document.querySelector('.site-nav-toggle .toggle').addEventListener('click', () => {
event.currentTarget.classList.toggle('toggle-close');
var siteNav = document.querySelector('.site-nav');
var ON_CLASS_NAME = 'site-nav-on';
var animateAction = siteNav.classList.contains(ON_CLASS_NAME) ? 'slideUp' : 'slideDown';
var animateAction = siteNav.classList.contains('site-nav-on') ? 'slideUp' : 'slideDown';

if (typeof Velocity === 'function') {
Velocity(siteNav, animateAction, {
duration: 200,
complete: function() {
siteNav.classList.toggle(ON_CLASS_NAME);
siteNav.classList.toggle('site-nav-on');
}
});
} else {
siteNav.classList.toggle(ON_CLASS_NAME);
siteNav.classList.toggle('site-nav-on');
}
});

Expand Down
Loading