This commit is contained in:
xaoxuu 2021-08-19 23:13:05 +08:00
parent 8460505e0a
commit c84fd83d73
8 changed files with 29 additions and 37 deletions

View File

@ -1,4 +1,4 @@
<div class='nav-wrap mobile-hidden'> <div class='nav-wrap'>
<nav class='sub post cap'> <nav class='sub post cap'>
<% if (is_home()) { %> <% if (is_home()) { %>
<a class='active' href='/'><%- __('btn.recent_publish') %></a> <a class='active' href='/'><%- __('btn.recent_publish') %></a>

View File

@ -1,7 +1,7 @@
<% <%
function layoutDiv() { function layoutDiv() {
var el = ''; var el = '';
el += '<div class="nav-wrap mobile-hidden">'; el += '<div class="nav-wrap">';
el += '<nav class="sub wiki cap">'; el += '<nav class="sub wiki cap">';
// 所有项目 // 所有项目
el += '<a'; el += '<a';

View File

@ -1,7 +1,11 @@
<% <%
function layoutMenu() { function layoutMenu() {
var el = ''; var el = '';
el += '<nav class="menu dis-select">' el += '<nav class="menu dis-select';
if (where == 'main') {
el += ' mobile-hidden';
}
el += '">';
for (let id of Object.keys(theme.sidebar.menu)) { for (let id of Object.keys(theme.sidebar.menu)) {
let item = theme.sidebar.menu[id]; let item = theme.sidebar.menu[id];
if (item == undefined || item.length == 0) { if (item == undefined || item.length == 0) {
@ -18,31 +22,6 @@ function layoutMenu() {
el += '</nav>'; el += '</nav>';
return el; return el;
} }
function layoutMainMenu() {
var el = '';
el += partial('logo');
el += '<nav class="menu dis-select">'
for (let id of Object.keys(theme.sidebar.menu)) {
let item = theme.sidebar.menu[id];
if (item == undefined || item.length == 0) {
continue;
}
el += '<a class="nav-item';
if (id == page.menu_id) {
el += ' active';
}
el += '" href="' + url_for(md_link(item)) + '">';
el += __(md_text(item));
el += '</a>';
}
el += '</nav>';
return el;
}
function layoutWikiMenu() {
var el = '';
el += partial('logo');
return el;
}
function layoutDiv() { function layoutDiv() {
var el = ''; var el = '';
el += '<header class="header'; el += '<header class="header';
@ -50,7 +29,11 @@ function layoutDiv() {
el += ' mobile-only'; el += ' mobile-only';
} }
el += '">'; el += '">';
if (where == 'main') {
el += '<button type="button" class="sidebar-toggle" onclick="sidebar.toggle()"><svg class="icon" style="width:1em;height:1em;vertical-align:middle;fill:currentColor;overflow:hidden" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="15301"><path d="M566.407 808.3c26.9-0.1 49.3-20.8 51.6-47.6-1.9-27.7-23.9-49.7-51.6-51.6h-412.6c-28.2-1.4-52.6 19.5-55.5 47.6 2.3 26.8 24.6 47.5 51.6 47.6h416.5v4z m309.3-249.9c26.9-0.1 49.3-20.8 51.6-47.6-2.2-26.8-24.6-47.5-51.6-47.6h-721.9c-27.7-2.8-52.5 17.4-55.3 45.1-0.1 0.8-0.1 1.7-0.2 2.5 0.9 27.2 23.6 48.5 50.7 47.6H875.707z m-103.1-245.9c26.9-0.1 49.3-20.8 51.6-47.6-0.4-28.3-23.2-51.1-51.5-51.6h-618.9c-29.5-1.1-54.3 21.9-55.5 51.4v0.2c1.4 27.8 25.2 49.2 53 47.8 0.8 0 1.7-0.1 2.5-0.2h618.8z" p-id="15302"></path><path d="M566.407 808.3c26.9-0.1 49.3-20.8 51.6-47.6-1.9-27.7-23.9-49.7-51.6-51.6h-412.6c-28.2-1.4-52.6 19.5-55.5 47.6 1.9 27.7 23.9 49.7 51.6 51.6h416.5z m309.3-249.9c26.9-0.1 49.3-20.8 51.6-47.6-2.2-26.8-24.6-47.5-51.6-47.6h-721.9c-27.7-2.8-52.5 17.4-55.3 45.1-0.1 0.8-0.1 1.7-0.2 2.5 0.9 27.2 23.6 48.5 50.7 47.6H875.707z m-103.1-245.9c26.9-0.1 49.3-20.8 51.6-47.6-0.4-28.3-23.2-51.1-51.5-51.6h-618.9c-29.5-1.1-54.3 21.9-55.5 51.4v0.2c1.4 27.8 25.2 49.2 53 47.8 0.8 0 1.7-0.1 2.5-0.2h618.8z" p-id="15303"></path></svg></button>';
}
el += partial('logo'); el += partial('logo');
if (where != 'main') {
if (page.layout === 'wiki' && page.wiki) { if (page.layout === 'wiki' && page.wiki) {
if (page.menu_id !== 'wiki') { if (page.menu_id !== 'wiki') {
el += layoutMenu(); el += layoutMenu();
@ -58,6 +41,8 @@ function layoutDiv() {
} else { } else {
el += layoutMenu(); el += layoutMenu();
} }
}
el += '</header>'; el += '</header>';
return el; return el;
} }

View File

@ -5,7 +5,7 @@
.mobile-hidden .mobile-hidden
@media screen and (max-width: $device-tablet) @media screen and (max-width: $device-tablet)
display: none display: none !important
.float-panel .float-panel
position: sticky position: sticky

View File

@ -57,7 +57,6 @@ $fs-p = $fs-15
$fs-code = $fs-13 $fs-code = $fs-13
$border-card = 12px $border-card = 12px
$border-widget = 4px
$border-block = 6px $border-block = 6px
$border-image = 6px $border-image = 6px

View File

@ -22,7 +22,7 @@
// iPad // iPad
@media screen and (max-width: $device-tablet) @media screen and (max-width: $device-tablet)
.mobile-only .mobile-only
display: block !important display: flex !important
.l_body .l_body
padding: 0 padding: 0
.l_left .l_left
@ -32,6 +32,7 @@
left: 0 left: 0
background: var(--site-bg) background: var(--site-bg)
box-shadow: $boxshadow-card-float box-shadow: $boxshadow-card-float
z-index: 10
.l_main .l_main
max-width: 100% max-width: 100%
.l_body.mobile .l_body.mobile

View File

@ -7,4 +7,11 @@
@media screen and (min-width: $device-tablet) @media screen and (min-width: $device-tablet)
padding-top: "calc(2 * %s)" % var(--gap-l) padding-top: "calc(2 * %s)" % var(--gap-l)
header header
margin: 2rem 1rem margin: 3rem 1rem 2rem
.sidebar-toggle
margin-right: .5rem
font-size: 1.25rem
background: none
color: var(--text-p1)
.logo-wrap
margin: 0

View File

@ -20,7 +20,7 @@
.logo-wrap .logo-wrap
margin: 1rem 0 .5rem margin: 1rem 0
display: flex display: flex
align-items: center align-items: center
overflow: hidden overflow: hidden