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

fix sidebar position #851

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
12 changes: 6 additions & 6 deletions layout/_macro/post.swig
Original file line number Diff line number Diff line change
Expand Up @@ -208,17 +208,17 @@
{% if not is_index and (post.prev or post.next) and not navlessPost %}
<div class="post-nav">
<div class="post-nav-next post-nav-item">
{% if post.next %}
<a href="{{ url_for(post.next.path) }}" rel="next" title="{{ post.next.title }}">
<i class="fa fa-chevron-left"></i> {{ post.next.title }}
{% if post.prev %}
<a href="{{ url_for(post.prev.path) }}" rel="prev" title="{{ post.prev.title }}">
<i class="fa fa-chevron-left"></i> {{ post.prev.title }}
</a>
{% endif %}
</div>

<div class="post-nav-prev post-nav-item">
{% if post.prev %}
<a href="{{ url_for(post.prev.path) }}" rel="prev" title="{{ post.prev.title }}">
{{post.prev.title}} <i class="fa fa-chevron-right"></i>
{% if post.next %}
<a href="{{ url_for(post.next.path) }}" rel="next" title="{{ post.next.title }}">
{{post.next.title}} <i class="fa fa-chevron-right"></i>
</a>
{% endif %}
</div>
Expand Down
20 changes: 10 additions & 10 deletions layout/_partials/footer.swig
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
&copy; {% if theme.since and theme.since != current %} {{ theme.since }} - {% endif %}
<span itemprop="copyrightYear">{{ current }}</span>
<span class="with-love">
<i class="fa fa-heart"></i>
<i class="fa fa-star"></i>
</span>
<span class="author" itemprop="copyrightHolder">{{ config.author }}</span>
</div>

<div class="powered-by">
{{ __('footer.powered', '<a class="theme-link" href="http://hexo.io">Hexo</a>') }}
</div>
<!-- <div class="powered-by"> -->
<!-- {{ __('footer.powered', '<a class="theme-link" href="http://hexo.io">Hexo</a>') }} -->
<!-- </div> -->

<div class="theme-info">
{{ __('footer.theme') }} -
<a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
NexT.{{ theme.scheme }}
</a>
</div>
<!-- <div class="theme-info"> -->
<!-- {{ __('footer.theme') }} - -->
<!-- <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next"> -->
<!-- NexT.{{ theme.scheme }} -->
<!-- </a> -->
<!-- </div> -->
17 changes: 17 additions & 0 deletions layout/_scripts/commons.swig
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@

{% if !theme.sidebar.position %}
{%
set js_commons = [
'src/utils.js',
'src/motion-right.js'
]
%}
{% elif theme.sidebar.position==='right' %}
{%
set js_commons = [
'src/utils.js',
'src/motion-right.js'
]
%}
{% else %}
{%
set js_commons = [
'src/utils.js',
'src/motion.js'
]
%}
{% endif %}

{% for common in js_commons %}
<script type="text/javascript" src="{{ url_for(theme.js) }}/{{ common }}?v={{ theme.version }}"></script>
Expand Down
29 changes: 29 additions & 0 deletions source/css/_common/components/back-to-top-right.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.back-to-top {
box-sizing: border-box;
position: fixed;
bottom: $b2t-position-bottom;
right: $b2t-position-right;
z-index: $zindex-5;
padding: 0 6px;
width: 25px;
background: $b2t-bg-color;
font-size: $b2t-font-size;
opacity: $b2t-opacity;
color: $b2t-color;
cursor: pointer;
text-align: center;
-webkit-transform: translateZ(0);
transition-property: bottom;
the-transition();

+mobile() {
display: none;
}
+tablet() {
display: none;
}

&.back-to-top-on {
bottom: $b2t-position-bottom-on;
}
}
2 changes: 1 addition & 1 deletion source/css/_common/components/back-to-top.styl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
box-sizing: border-box;
position: fixed;
bottom: $b2t-position-bottom;
right: $b2t-position-right;
left: $b2t-position-right;
z-index: $zindex-5;
padding: 0 6px;
width: 25px;
Expand Down
9 changes: 8 additions & 1 deletion source/css/_common/components/components.styl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@
@import "pagination";
@import "comments";
@import "tag-cloud";
@import "back-to-top";

$pos = hexo-config('sidebar.position');
$pos = !$pos?'left':$pos;
if $pos in ('left')
@import "back-to-top";
else if $pos in ('right')
@import "back-to-top-right";


@import "header";
@import "post";
Expand Down
2 changes: 1 addition & 1 deletion source/css/_common/components/post/post.styl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.post-body {
font-family: $font-family-posts;
+mobile() {
word-break: break-word;
word-break: break-all;
}
}

Expand Down
34 changes: 34 additions & 0 deletions source/css/_common/components/sidebar/sidebar-toggle-right.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.sidebar-toggle {
position: fixed;
right: 50px;
bottom: 45px;
width: 15px;
height: 15px;
padding: 5px;
background: $black-deep;
line-height: 0;
z-index: $zindex-5;
cursor: pointer;
-webkit-transform: translateZ(0);

+tablet() {
display: none;
}
+mobile() {
display: none;
}
}



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

&:first-child { margin-top: 0; }
}
2 changes: 1 addition & 1 deletion source/css/_common/components/sidebar/sidebar-toggle.styl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.sidebar-toggle {
position: fixed;
right: 50px;
left: 50px;
bottom: 45px;
width: 15px;
height: 15px;
Expand Down
8 changes: 7 additions & 1 deletion source/css/_common/components/sidebar/sidebar.styl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@
text-align: center;
}

@import "sidebar-toggle";
//$pos = hexo-config('position');

if $pos in ('left')
@import "sidebar-toggle";
else if $pos in ('right')
@import "sidebar-toggle-right";

@import "sidebar-author";
@import "site-state";
@import "sidebar-feed-link";
Expand Down
4 changes: 2 additions & 2 deletions source/css/_common/scaffolding/base.styl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ body {
color: $text-color;
background: $body-bg-color;

+mobile() { padding-right: 0 !important; }
+tablet() { padding-right: 0 !important; }
+mobile() { padding-right: 0 !important; padding-left: 0 !important; }
+tablet() { padding-right: 0 !important; padding-left: 0 !important; }
+desktop-large() { font-size: $font-size-large; }
}

Expand Down
2 changes: 1 addition & 1 deletion source/css/_common/scaffolding/tables.styl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ table {
border: 1px solid $table-border-color;
font-size: $table-font-size;
table-layout: fixed;
word-wrap: break-all;
word-wrap: break-word;
}
table>tbody>tr {
&:nth-of-type(odd) { background-color: $table-row-odd-bg-color; }
Expand Down
2 changes: 1 addition & 1 deletion source/css/main.styl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ $scheme = hexo-config('scheme') ? hexo-config('scheme') : 'Muse';
$variables = base $scheme custom;
$mixins = base $scheme custom;


//console.info($scheme);

// Variables Layer
// --------------------------------------------------
Expand Down
Loading