theme: rework header UX #151

This commit is contained in:
Sören Weber 2022-02-18 00:09:06 +01:00
parent ff06a8ad41
commit 6f35177349
No known key found for this signature in database
GPG key ID: 07D17FF580AE7589
6 changed files with 73 additions and 112 deletions

View file

@ -1,9 +1,4 @@
{{- partial "header.html" . }} {{- partial "header.html" . }}
<span id="sidebar-toggle-span">
<a href="#" id="sidebar-toggle" title='{{ T "Navigation-toggle" }}' data-sidebar-toggle="">
<i class="fas fa-bars"></i>
</a>
</span>
{{if .Site.Home.Content }} {{if .Site.Home.Content }}
{{.Site.Home.Content}} {{.Site.Home.Content}}

View file

@ -4,17 +4,6 @@
</main><!-- #body-inner --> </main><!-- #body-inner -->
{{- partial "custom-comments.html" . }} {{- partial "custom-comments.html" . }}
</div> </div>
<div id="navigation">
{{- $showPrevNext := (and (not .Params.disableNextPrev) (not .Site.Params.disableNextPrev)) }}
{{- if $showPrevNext }}
{{- with ($.Scratch.Get "relearnPrevPage") }}
<a class="nav nav-prev default-animation" href="{{.RelPermalink}}" title="{{.Title}}"><i class="fa fa-chevron-left"></i></a>
{{- end}}
{{- with ($.Scratch.Get "relearnNextPage") }}
<a class="nav nav-next default-animation" href="{{.RelPermalink}}" title="{{.Title}}"><i class="fa fa-chevron-right"></i></a>
{{- end }}
{{- end }}
</div>
</div><!-- #body --> </div><!-- #body -->
<div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"> <div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
<div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div> <div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>

View file

@ -29,15 +29,35 @@
<div id="body" class="default-animation"> <div id="body" class="default-animation">
<div id="overlay"></div> <div id="overlay"></div>
<div class="padding highlightable"> <div class="padding highlightable">
{{- if not .IsHome }}
<div id="top-bar"><div> <div id="top-bar"><div>
{{- if and (or .IsPage .IsSection) .Site.Params.editURL }} {{- $showPrevNext := (and (not .Params.disableNextPrev) (not .Site.Params.disableNextPrev)) }}
{{- if $showPrevNext }}
<div class="navigation">
{{- if ($.Scratch.Get "relearnNextPage") }}
{{- with ($.Scratch.Get "relearnNextPage") }}
<a class="nav nav-next" href="{{.RelPermalink}}" title="{{.Title}}"><i class="fa fa-chevron-right fa-fw"></i></a>
{{- end }}
{{- else }}
<span class="nav nav-next"><i class="fa fa-chevron-right fa-fw"></i></span>
{{- end }}
</div>
<div class="navigation">
{{- if ($.Scratch.Get "relearnPrevPage") }}
{{- with ($.Scratch.Get "relearnPrevPage") }}
<a class="nav nav-prev" href="{{.RelPermalink}}" title="{{.Title}}"><i class="fa fa-chevron-left fa-fw"></i></a>
{{- end}}
{{- else }}
<span class="nav nav-prev"><i class="fa fa-chevron-left fa-fw"></i></span>
{{- end}}
</div>
{{- end }}
{{- if .Site.Params.editURL }}
{{- $File := .File }} {{- $File := .File }}
{{- $Site := .Site }} {{- $Site := .Site }}
{{- with $File.Path }} {{- with $File.Path }}
<div id="top-github-link"> <div id="top-github-link">
<a class="github-link" title='{{ T "Edit-this-page" }}' href="{{ $Site.Params.editURL }}{{ replace $File.Dir "\\" "/" }}{{ $File.LogicalName }}" target="blank"> <a class="github-link" title='{{ T "Edit-this-page" }}' href="{{ $Site.Params.editURL }}{{ replace $File.Dir "\\" "/" }}{{ $File.LogicalName }}" target="blank">
<i class="fas fa-pencil"></i> <i class="fas fa-pencil fa-fw"></i>
</a> </a>
</div> </div>
{{- end }} {{- end }}
@ -49,11 +69,11 @@
<div id="breadcrumbs"> <div id="breadcrumbs">
<span id="sidebar-toggle-span"> <span id="sidebar-toggle-span">
<a href="#" id="sidebar-toggle" title='{{ T "Navigation-toggle" }}' data-sidebar-toggle=""> <a href="#" id="sidebar-toggle" title='{{ T "Navigation-toggle" }}' data-sidebar-toggle="">
<i class="fas fa-bars"></i> <i class="fas fa-bars fa-fw"></i>
</a> </a>
</span> </span>
{{- if $toc }} {{- if $toc }}
<span id="toc-menu"><i class="fas fa-list-alt"></i></span> <span id="toc-menu"><i class="fas fa-list-alt fa-fw"></i></span>
{{- end }} {{- end }}
{{- $showBreadcrumb := (and (not .Params.disableBreadcrumb) (not .Site.Params.disableBreadcrumb)) }} {{- $showBreadcrumb := (and (not .Params.disableBreadcrumb) (not .Site.Params.disableBreadcrumb)) }}
{{- if $showBreadcrumb }} {{- if $showBreadcrumb }}
@ -71,7 +91,6 @@
{{- partial "toc.html" . }} {{- partial "toc.html" . }}
{{- end }} {{- end }}
</div></div> </div></div>
{{- end }}
<div id="head-tags"> <div id="head-tags">
{{- partial "tags.html" . }} {{- partial "tags.html" . }}
</div> </div>

View file

@ -36,6 +36,7 @@ pre {
padding-left: 0; /* for print, we want to align with the footer to ease the layout */ padding-left: 0; /* for print, we want to align with the footer to ease the layout */
color: #777; color: #777;
} }
.navigation,
#top-github-link { #top-github-link {
/* we don't need this while printing */ /* we don't need this while printing */
display: none; display: none;

View file

@ -353,17 +353,22 @@ th {
} }
#body .padding { #body .padding {
padding: 3rem 6rem; padding: 0;
}
#body-inner {
padding: 0 3rem 4rem 3rem;
} }
@media only all and (max-width: 59.938em) { @media only all and (max-width: 59.938em) {
#body .padding { #body .padding {
position: static; position: static;
padding: 15px 3rem; }
#body-inner {
padding: 0 2rem 15px 2rem;
} }
} }
@media only all and (max-width: 47.938em) { @media only all and (max-width: 47.938em) {
#body .padding { #body-inner {
padding: 5px 1rem; padding: 0 1rem 5px 1rem;
} }
} }
@ -372,60 +377,6 @@ th {
margin-top: -1rem; margin-top: -1rem;
} }
@media only all and (max-width: 59.938em) {
#body #navigation {
display: table;
margin-right: 0 !important;
position: static;
width: 100%;
}
}
#body .nav {
bottom: 0;
cursor: pointer;
display: table;
font-size: 50px;
height: 100%;
position: fixed;
text-align: center;
top: 0;
width: 4rem;
}
#body .nav > i {
display: table-cell;
text-align: center;
vertical-align: middle;
}
@media only all and (max-width: 59.938em) {
#body .nav {
display: table-cell;
height: 100px;
line-height: 100px;
padding-top: 0;
position: static;
text-align: center;
top: auto;
width: 50%;
}
#body .nav > i {
display: inline-block;
}
}
#body .nav:hover {
background-color: rgba( 134, 134, 134, .066 );
}
#body .nav.nav-pref {
left: 0;
}
#body .nav.nav-next {
margin-right: 0px;
right: 0;
}
/* we limit width if we have large screens */ /* we limit width if we have large screens */
@media screen and ( min-width: 1300px ){ /* #sidebar/width + ./max-width */ @media screen and ( min-width: 1300px ){ /* #sidebar/width + ./max-width */
#body #body-inner { #body #body-inner {
@ -935,27 +886,40 @@ td {
#top-bar > div { #top-bar > div {
background-color: rgba( 134, 134, 134, .066 ); background-color: rgba( 134, 134, 134, .066 );
padding: 0 1rem;
height: 100%; height: 100%;
} }
#top-bar.is-sticky { .navigation,
box-shadow: 1px 2px 5px 1px rgba( 134, 134, 134, .2 );
}
#top-github-link { #top-github-link {
display: block; display: block;
float: right; float: right;
z-index: 1; z-index: 1;
} }
#top-github-link, .nav,
#body #breadcrumbs { .github-link {
border-left: thin solid rgba( 134, 134, 134, .333 );
padding-left: 1rem;
padding-right: 1rem;
}
span.nav i{
color: rgba( 134, 134, 134, .333 );
}
.navigation,
#top-github-link {
position: relative; position: relative;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
} }
#toc-menu,
#sidebar-toggle-span {
border-right: thin solid rgba( 134, 134, 134, .333 );
padding-left: 1rem;
padding-right: 1rem;
}
#body #breadcrumbs { #body #breadcrumbs {
display: inline-block; display: inline-block;
float: left; float: left;
@ -963,29 +927,33 @@ td {
line-height: 1.4; line-height: 1.4;
margin-bottom: 0; margin-bottom: 0;
overflow: hidden; overflow: hidden;
padding-left: 0; position: relative;
text-overflow: ellipsis; text-overflow: ellipsis;
top: 50%;
transform: translateY(-50%);
white-space: nowrap; white-space: nowrap;
width: 70%; width: calc(100% - 4*3.25rem);
} }
#sidebar-toggle-span { #sidebar-toggle-span {
display: none; display: none;
} }
.progress {
left: 1rem;
top: 1rem;
}
@media only all and (max-width: 47.938em) { @media only all and (max-width: 47.938em) {
#sidebar-toggle-span { #sidebar-toggle-span {
display: inline; display: inline;
} }
} .progress {
left: 4.25rem;
#body #breadcrumbs span { }
padding: 0 0.1rem;
} }
#body #breadcrumbs .links { #body #breadcrumbs .links {
display: inline; display: inline;
padding: 0 0.1rem; padding: 0 .75rem;
} }
#body #breadcrumbs .links * { #body #breadcrumbs .links * {
@ -1042,7 +1010,7 @@ a[aria-disabled="true"] {
position: absolute; position: absolute;
right: 0; right: 0;
top: 0; top: 0;
z-index: 10; z-index: 1000;
} }
} }
@ -1224,6 +1192,7 @@ option {
width: 100%; width: 100%;
} }
#body .navigation a.highlight:after,
#body #sidebar-toggle-span a.highlight:after, #body #sidebar-toggle-span a.highlight:after,
#body #top-github-link a.highlight:after { #body #top-github-link a.highlight:after {
background-color: transparent; background-color: transparent;
@ -1262,18 +1231,6 @@ option {
font-weight: 500; font-weight: 500;
} }
#toc-menu {
border-right: thin solid rgba( 134, 134, 134, .333 );
margin-right: 0.5rem !important;
padding-right: 1rem !important;
}
#sidebar-toggle-span {
border-right: thin solid rgba( 134, 134, 134, .333 );
margin-right: 1rem !important;
padding-right: 0.5rem !important;
}
.btn { .btn {
background-image: none !important; background-image: none !important;
border: 1px solid transparent !important; border: 1px solid transparent !important;

View file

@ -375,10 +375,10 @@ jQuery(function() {
// allow keyboard control for prev/next links // allow keyboard control for prev/next links
jQuery(function() { jQuery(function() {
jQuery('.nav-prev').click(function(){ jQuery('a.nav-prev').click(function(){
location.href = jQuery(this).attr('href'); location.href = jQuery(this).attr('href');
}); });
jQuery('.nav-next').click(function() { jQuery('a.nav-next').click(function() {
location.href = jQuery(this).attr('href'); location.href = jQuery(this).attr('href');
}); });
}); });
@ -393,12 +393,12 @@ jQuery(function() {
jQuery(document).keydown(function(e) { jQuery(document).keydown(function(e) {
// prev links - left arrow key // prev links - left arrow key
if(e.which == '37') { if(e.which == '37') {
jQuery('.nav.nav-prev').click(); jQuery('a.nav-prev').click();
} }
// next links - right arrow key // next links - right arrow key
if(e.which == '39') { if(e.which == '39') {
jQuery('.nav.nav-next').click(); jQuery('a.nav-next').click();
} }
}); });