mirror of
https://github.com/next-theme/hexo-theme-next.git
synced 2026-01-17 18:22:33 +00:00
Refactor layout (#31)
This commit is contained in:
parent
4bcccea378
commit
a1ee9a7e37
@ -13,25 +13,23 @@
|
|||||||
<div class="container{%- if theme.motion.enable %} use-motion{%- endif %}">
|
<div class="container{%- if theme.motion.enable %} use-motion{%- endif %}">
|
||||||
<div class="headband"></div>
|
<div class="headband"></div>
|
||||||
|
|
||||||
|
<main class="main">
|
||||||
<header class="header" itemscope itemtype="http://schema.org/WPHeader">
|
<header class="header" itemscope itemtype="http://schema.org/WPHeader">
|
||||||
<div class="header-inner">{% include '_partials/header/index.njk' %}</div>
|
<div class="header-inner">{% include '_partials/header/index.njk' %}</div>
|
||||||
|
{%- if theme.sidebar.display !== 'remove' %}
|
||||||
|
{% block sidebar %}{% endblock %}
|
||||||
|
{%- endif %}
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
{{ partial('_partials/widgets.njk', {}, {cache: theme.cache.enable}) }}
|
{{ partial('_partials/widgets.njk', {}, {cache: theme.cache.enable}) }}
|
||||||
|
|
||||||
<main class="main">
|
|
||||||
<div class="main-inner">
|
<div class="main-inner">
|
||||||
<div class="content-wrap">
|
|
||||||
{% include '_partials/header/sub-menu.njk' %}
|
{% include '_partials/header/sub-menu.njk' %}
|
||||||
<div class="content {% block class %}{% endblock %}">
|
<div class="content {% block class %}{% endblock %}">
|
||||||
{% block content %}{% endblock %}
|
{% block content %}{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
{% include '_partials/comments.njk' %}
|
{% include '_partials/comments.njk' %}
|
||||||
</div>
|
</div>
|
||||||
{%- if theme.sidebar.display !== 'remove' %}
|
|
||||||
{% block sidebar %}{% endblock %}
|
|
||||||
{%- endif %}
|
|
||||||
</div>
|
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
|
|||||||
@ -3,7 +3,7 @@ var pjax = new Pjax({
|
|||||||
selectors: [
|
selectors: [
|
||||||
'head title',
|
'head title',
|
||||||
'#page-configurations',
|
'#page-configurations',
|
||||||
'.content-wrap',
|
'.main-inner',
|
||||||
'.post-toc-wrap',
|
'.post-toc-wrap',
|
||||||
'.languages',
|
'.languages',
|
||||||
'#pjax'
|
'#pjax'
|
||||||
|
|||||||
@ -1,7 +1,3 @@
|
|||||||
.content {
|
|
||||||
padding-top: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.post-body {
|
.post-body {
|
||||||
+desktop() {
|
+desktop() {
|
||||||
text-align: unquote(hexo-config('text_align.desktop'));
|
text-align: unquote(hexo-config('text_align.desktop'));
|
||||||
@ -39,7 +35,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
iframe, img, video {
|
iframe, img, video, embed {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,16 +5,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.header-inner {
|
.header-inner {
|
||||||
margin: 0 auto;
|
main-container();
|
||||||
width: $content-desktop;
|
|
||||||
|
|
||||||
+desktop-large() {
|
|
||||||
width: $content-desktop-large;
|
|
||||||
}
|
|
||||||
|
|
||||||
+desktop-largest() {
|
|
||||||
width: $content-desktop-largest;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.site-brand-container {
|
.site-brand-container {
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
+mobile-small() {
|
+mobile-small() {
|
||||||
// For Pisces & Gemini schemes only wider width (remove main blocks in Gemini).
|
// For Pisces & Gemini schemes only wider width (remove main blocks in Gemini).
|
||||||
.content-wrap {
|
.main-inner {
|
||||||
padding: initial !important;
|
padding: initial !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,25 +3,6 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-inner {
|
|
||||||
margin: 0 auto;
|
|
||||||
width: $content-desktop;
|
|
||||||
|
|
||||||
+desktop-large() {
|
|
||||||
width: $content-desktop-large;
|
|
||||||
}
|
|
||||||
|
|
||||||
+desktop-largest() {
|
|
||||||
width: $content-desktop-largest;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.content-wrap {
|
|
||||||
+mobile() {
|
|
||||||
padding: 0 20px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@import 'header';
|
@import 'header';
|
||||||
@import 'sidebar';
|
@import 'sidebar';
|
||||||
@import 'footer';
|
@import 'footer';
|
||||||
|
|||||||
@ -49,7 +49,7 @@ a, span.exturl {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
iframe, img, video {
|
iframe, img, video, embed {
|
||||||
display: block;
|
display: block;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
|
|||||||
@ -96,3 +96,16 @@ font-family-icons($icon = '') {
|
|||||||
font-family: 'Font Awesome 5 Free';
|
font-family: 'Font Awesome 5 Free';
|
||||||
font-weight: 900;
|
font-weight: 900;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
main-container() {
|
||||||
|
margin: 0 auto;
|
||||||
|
width: $content-desktop;
|
||||||
|
|
||||||
|
+desktop-large() {
|
||||||
|
width: $content-desktop-large;
|
||||||
|
}
|
||||||
|
|
||||||
|
+desktop-largest() {
|
||||||
|
width: $content-desktop-largest;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -27,7 +27,7 @@ $use-seo = hexo-config('seo');
|
|||||||
// Desktop layout styles.
|
// Desktop layout styles.
|
||||||
// ==================================================
|
// ==================================================
|
||||||
// Post blocks.
|
// Post blocks.
|
||||||
.content-wrap {
|
.main-inner {
|
||||||
background: initial;
|
background: initial;
|
||||||
box-shadow: initial;
|
box-shadow: initial;
|
||||||
padding: initial;
|
padding: initial;
|
||||||
@ -139,7 +139,7 @@ $use-seo = hexo-config('seo');
|
|||||||
// ==================================================
|
// ==================================================
|
||||||
+tablet() {
|
+tablet() {
|
||||||
// Posts in blocks.
|
// Posts in blocks.
|
||||||
.content-wrap {
|
.main-inner {
|
||||||
padding: $content-tablet-padding;
|
padding: $content-tablet-padding;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ $use-seo = hexo-config('seo');
|
|||||||
// ==================================================
|
// ==================================================
|
||||||
+mobile() {
|
+mobile() {
|
||||||
// Posts in blocks.
|
// Posts in blocks.
|
||||||
.content-wrap {
|
.main-inner {
|
||||||
padding: $content-mobile-padding;
|
padding: $content-mobile-padding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,6 @@
|
|||||||
+mobile() {
|
+mobile() {
|
||||||
display: block;
|
display: block;
|
||||||
padding: 10px 0;
|
padding: 10px 0;
|
||||||
width: auto;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -19,10 +19,6 @@ hr {
|
|||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
.main-inner {
|
.main-inner {
|
||||||
padding-bottom: 80px;
|
padding-bottom: 80px;
|
||||||
|
|
||||||
+mobile() {
|
|
||||||
width: auto;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
@ -57,6 +53,5 @@ hr {
|
|||||||
|
|
||||||
+mobile() {
|
+mobile() {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: auto;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,5 +5,6 @@
|
|||||||
@import '_header';
|
@import '_header';
|
||||||
@import '_menu';
|
@import '_menu';
|
||||||
@import '_posts-expand';
|
@import '_posts-expand';
|
||||||
|
@import '../Muse/_layout';
|
||||||
@import '../Muse/_sidebar';
|
@import '../Muse/_sidebar';
|
||||||
@import '../Muse/_sub-menu';
|
@import '../Muse/_sub-menu';
|
||||||
|
|||||||
@ -8,3 +8,23 @@
|
|||||||
.brand {
|
.brand {
|
||||||
background: var(--btn-default-bg);
|
background: var(--btn-default-bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.header-inner {
|
||||||
|
padding-top: 100px;
|
||||||
|
|
||||||
|
+mobile() {
|
||||||
|
padding-top: 50px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-inner {
|
||||||
|
padding-bottom: 60px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
padding-top: 70px;
|
||||||
|
|
||||||
|
+mobile() {
|
||||||
|
padding-top: 35px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -1,30 +1,14 @@
|
|||||||
|
.main-inner {
|
||||||
|
main-container();
|
||||||
|
|
||||||
|
+mobile() {
|
||||||
|
padding-left: 20px;
|
||||||
|
padding-right: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.header-inner, .main-inner, .footer-inner {
|
.header-inner, .main-inner, .footer-inner {
|
||||||
+mobile() {
|
+mobile() {
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-inner {
|
|
||||||
padding-top: 100px;
|
|
||||||
|
|
||||||
+mobile() {
|
|
||||||
padding-top: 50px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.main-inner {
|
|
||||||
padding-bottom: 60px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content {
|
|
||||||
padding-top: 70px;
|
|
||||||
|
|
||||||
+mobile() {
|
|
||||||
padding-top: 35px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
embed {
|
|
||||||
display: block;
|
|
||||||
margin: 0 auto 25px auto;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,14 +1,11 @@
|
|||||||
.header {
|
.header {
|
||||||
margin: 0 auto;
|
// Make sure that .header and .main-inner are the same height
|
||||||
position: relative;
|
// Required for .sidebar `position: sticky;`
|
||||||
width: $content-desktop;
|
align-self: stretch;
|
||||||
|
width: $sidebar-desktop;
|
||||||
|
|
||||||
+desktop-large() {
|
+desktop-large() {
|
||||||
width: $content-desktop-large;
|
width: $sidebar-desktop;
|
||||||
}
|
|
||||||
|
|
||||||
+desktop-largest() {
|
|
||||||
width: $content-desktop-largest;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+tablet-mobile() {
|
+tablet-mobile() {
|
||||||
@ -22,7 +19,6 @@
|
|||||||
box-shadow: $box-shadow-inner;
|
box-shadow: $box-shadow-inner;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
top: 0;
|
||||||
width: $sidebar-desktop;
|
width: $sidebar-desktop;
|
||||||
|
|
||||||
@ -37,20 +33,23 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-inner {
|
.main {
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
main-container();
|
||||||
|
|
||||||
if (hexo-config('sidebar.position') != 'right') {
|
if (hexo-config('sidebar.position') == 'right') {
|
||||||
flex-direction: row-reverse;
|
flex-direction: row-reverse;
|
||||||
}
|
}
|
||||||
|
|
||||||
+tablet-mobile() {
|
+tablet-mobile() {
|
||||||
|
display: block;
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.content-wrap {
|
.main-inner {
|
||||||
align-self: stretch;
|
align-self: stretch;
|
||||||
background: var(--content-bg-color);
|
background: var(--content-bg-color);
|
||||||
border-radius: $border-radius-inner;
|
border-radius: $border-radius-inner;
|
||||||
@ -66,6 +65,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
padding-top: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
if (hexo-config('sidebar.position') == 'right') {
|
if (hexo-config('sidebar.position') == 'right') {
|
||||||
.header-inner {
|
.header-inner {
|
||||||
right: 0;
|
right: 0;
|
||||||
|
|||||||
@ -1,11 +1,9 @@
|
|||||||
.sidebar {
|
.sidebar {
|
||||||
// Make sure that .content-wrap and .sidebar are the same height
|
bottom: initial;
|
||||||
// Required for .sidebar-inner `position: sticky;`
|
|
||||||
align-self: stretch;
|
|
||||||
background: initial;
|
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
position: static;
|
margin-top: $sidebar-offset;
|
||||||
width: $sidebar-desktop;
|
position: sticky;
|
||||||
|
top: $sidebar-offset;
|
||||||
|
|
||||||
+tablet-mobile() {
|
+tablet-mobile() {
|
||||||
display: none;
|
display: none;
|
||||||
@ -22,9 +20,6 @@
|
|||||||
box-shadow: $box-shadow;
|
box-shadow: $box-shadow;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
color: var(--text-color);
|
color: var(--text-color);
|
||||||
position: sticky;
|
|
||||||
top: $sidebar-offset;
|
|
||||||
width: $sidebar-desktop;
|
|
||||||
|
|
||||||
if (hexo-config('motion.enable') && hexo-config('motion.transition.sidebar')) {
|
if (hexo-config('motion.enable') && hexo-config('motion.transition.sidebar')) {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
@ -97,10 +92,6 @@
|
|||||||
if (hexo-config('links_settings.layout') == 'inline') {
|
if (hexo-config('links_settings.layout') == 'inline') {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
sidebar-inline-links-item();
|
sidebar-inline-links-item();
|
||||||
|
|
||||||
if (!hexo-config('social_icons.icons_only')) {
|
|
||||||
width: unset;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -71,15 +71,6 @@ NexT.boot.registerEvents = function() {
|
|||||||
target && target.click();
|
target && target.click();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (CONFIG.scheme === 'Pisces' || CONFIG.scheme === 'Gemini') {
|
|
||||||
NexT.utils.setAffixParam();
|
|
||||||
window.matchMedia('(min-width: 992px)').addListener(event => {
|
|
||||||
if (event.matches) {
|
|
||||||
NexT.utils.setAffixParam();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
NexT.boot.refresh = function() {
|
NexT.boot.refresh = function() {
|
||||||
|
|||||||
@ -354,13 +354,6 @@ NexT.utils = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setAffixParam: function() {
|
|
||||||
const sidebarOffset = CONFIG.sidebar.offset || 12;
|
|
||||||
const headerOffset = document.querySelector('.header-inner').offsetHeight;
|
|
||||||
|
|
||||||
document.querySelector('.sidebar-inner').style.marginTop = headerOffset + sidebarOffset + 'px';
|
|
||||||
},
|
|
||||||
|
|
||||||
getScript: function(url, callback, condition) {
|
getScript: function(url, callback, condition) {
|
||||||
if (condition) {
|
if (condition) {
|
||||||
callback();
|
callback();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user