Use unified navbar for all pages

Signed-off-by: hossainemruz <hossainemruz@gmail.com>
This commit is contained in:
hossainemruz 2023-09-26 03:58:32 +06:00
parent 5a9af3cc46
commit cb0ae29984
24 changed files with 243 additions and 298 deletions

View file

@ -1,8 +1,11 @@
import 'popper.js' import 'popper.js'
import 'bootstrap' import 'bootstrap'
import '@fortawesome/fontawesome-free/js/all' import '@fortawesome/fontawesome-free/js/all'
import feather from 'feather-icons'
import './core' import './core'
import './features' import './features'
import './sections' import './sections'
import './pages' import './pages'
feather.replace();

View file

@ -4,8 +4,8 @@ const updateNavBar = () => {
const themeIcon = document.getElementById('navbar-theme-icon-svg') const themeIcon = document.getElementById('navbar-theme-icon-svg')
if (window.scrollY > 40) { if (window.scrollY > 40) {
topNavbar?.classList.remove('initial-navbar') topNavbar?.classList.remove('transparent-navbar')
topNavbar?.classList.add('final-navbar', 'shadow') topNavbar?.classList.add('shadow')
navbarToggler?.classList.remove('navbar-dark') navbarToggler?.classList.remove('navbar-dark')
navbarToggler?.classList.add('navbar-light') navbarToggler?.classList.add('navbar-light')
@ -20,8 +20,8 @@ const updateNavBar = () => {
document.getElementById('logo')?.setAttribute('src', logoURL) document.getElementById('logo')?.setAttribute('src', logoURL)
} }
} else { } else {
topNavbar?.classList.remove('final-navbar', 'shadow') topNavbar?.classList.remove('shadow')
topNavbar?.classList.add('initial-navbar') topNavbar?.classList.add('transparent-navbar')
navbarToggler?.classList.remove('navbar-light') navbarToggler?.classList.remove('navbar-light')
navbarToggler?.classList.add('navbar-dark') navbarToggler?.classList.add('navbar-dark')
@ -43,18 +43,20 @@ document.addEventListener('DOMContentLoaded', function () {
// ================================================== // ==================================================
// When the user scrolls down 80px from the top of the document, // When the user scrolls down 80px from the top of the document,
// resize the navbar's padding and the logo's font size // resize the navbar's padding and the logo's font size
document.addEventListener('scroll', updateNavBar) const topNavbar = document.getElementById('top-navbar')
if (topNavbar?.classList.contains('homepage')) {
document.addEventListener('scroll', updateNavBar)
updateNavBar()
}
// Creates a click handler to collapse the navigation when // Creates a click handler to collapse the navigation when
// anchors in the mobile nav pop up are clicked // anchors in the mobile nav pop up are clicked
const navMain =document.getElementsByClassName('navbar-collapse') const navMain = document.getElementsByClassName('navbar-collapse')
Array.from(navMain).forEach(function(el) { Array.from(navMain).forEach(function (el) {
el.addEventListener('click', function (e) { el.addEventListener('click', function (e) {
if (e.target.tagName === 'A') { if (e.target.tagName === 'A') {
el.classList.add('collapse') el.classList.add('collapse')
} }
}) })
}) })
updateNavBar()
}) })

View file

@ -1,5 +1,5 @@
body.kind-404 { body.kind-404 {
.navbar-toggler { #sidebar-toggler {
display: none; display: none;
} }

View file

@ -110,10 +110,6 @@ body.kind-page {
display: block; display: block;
} }
#toc-toggler {
visibility: hidden;
}
.navbar-collapse.lang-selector { .navbar-collapse.lang-selector {
display: block !important; display: block !important;
position: absolute; position: absolute;
@ -164,7 +160,6 @@ body.kind-page {
margin-top: 0.5rem; margin-top: 0.5rem;
transition: all ease-out 0.3s; transition: all ease-out 0.3s;
} }
} }
@include media('<medium') { @include media('<medium') {
.post-card { .post-card {
@ -173,17 +168,17 @@ body.kind-page {
width: 98%; width: 98%;
} }
} }
@include media('>=medium','<large') { @include media('>=medium', '<large') {
.post-card { .post-card {
width: calc(100% / 2); width: calc(100% / 2);
} }
} }
@include media('>=large','<very-large') { @include media('>=large', '<very-large') {
.post-card { .post-card {
width: calc(100% / 3); width: calc(100% / 3);
} }
} }
@include media('>=very-large','<extra-large') { @include media('>=very-large', '<extra-large') {
.post-card { .post-card {
width: calc(100% / 4); width: calc(100% / 4);
} }

View file

@ -16,63 +16,63 @@ body.type-notes {
padding-left: 0.5rem; padding-left: 0.5rem;
padding-right: 0.5rem; padding-right: 0.5rem;
} }
.content { .content {
padding: 0; padding: 0;
position: relative; position: relative;
padding-top: 2rem; padding-top: 2rem;
min-height: 130vh; min-height: 130vh;
} }
.note-card-holder{ .note-card-holder {
padding-top: 2rem; padding-top: 2rem;
display: grid; display: grid;
grid-gap: 0.5rem; grid-gap: 0.5rem;
grid-template-columns: repeat(auto-fill, minmax(30rem,1fr)); grid-template-columns: repeat(auto-fill, minmax(30rem, 1fr));
grid-auto-rows: 20px; grid-auto-rows: 20px;
} }
/* .note-collection { /* .note-collection {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
} */ } */
.note-card { .note-card {
align-self: flex-start; align-self: flex-start;
} }
.note-card .card{ .note-card .card {
margin: 0.5rem; margin: 0.5rem;
} }
.note-title{ .note-title {
padding-left: 1rem; padding-left: 1rem;
color: #248aaa; color: #248aaa;
} }
.note-title span{ .note-title span {
background: #e5e9f2; background: #e5e9f2;
padding-right: 5px; padding-right: 5px;
} }
.note-title:before{ .note-title:before {
content:''; content: '';
display:inline-block; display: inline-block;
width:98%; width: 98%;
height:100%; height: 100%;
margin-bottom:-26px; margin-bottom: -26px;
border-bottom: 1px solid #248aaa; border-bottom: 1px solid #248aaa;
} }
.note-card .card-body{ .note-card .card-body {
padding: 1rem; padding: 1rem;
} }
.note-card pre { .note-card pre {
margin: 0; margin: 0;
border-radius: 3px; border-radius: 3px;
} }
/* .small-note{ /* .small-note{
max-width: 15rem; max-width: 15rem;
} }
@ -86,14 +86,13 @@ body.type-notes {
} }
.huge-note{} */ .huge-note{} */
.note-badge{ .note-badge {
font-size: 10pt; font-size: 10pt;
} }
/* ============= Device specific fixes ======= */ /* ============= Device specific fixes ======= */
/* Large screens such as TV */ /* Large screens such as TV */
@media only screen and (min-width: 1824px) { @media only screen and (min-width: 1824px) {
.content-section { .content-section {
@ -103,20 +102,18 @@ body.type-notes {
max-width: 85%; max-width: 85%;
} }
} }
/* Extra large devices (large desktops, 1200px and up) */ /* Extra large devices (large desktops, 1200px and up) */
@media (max-width: 1400px) { @media (max-width: 1400px) {
.note-card-holder { .note-card-holder {
margin-left: 0px; margin-left: 0px;
} }
} }
@media (max-width: 1200px) { @media (max-width: 1200px) {
} }
/* IPad Pro */ /* IPad Pro */
@media (max-width: 1024px) { @media (max-width: 1024px) {
.wrapper { .wrapper {
@ -130,12 +127,12 @@ body.type-notes {
padding-bottom: 0.5rem; padding-bottom: 0.5rem;
transition: all ease-out 0.3s; transition: all ease-out 0.3s;
} }
.content-section.hide { .content-section.hide {
max-width: 60%; max-width: 60%;
transition: all ease-out 0.3s; transition: all ease-out 0.3s;
} }
.content { .content {
overflow: hidden; overflow: hidden;
} }
@ -145,18 +142,14 @@ body.type-notes {
.navbar-toggler { .navbar-toggler {
display: block; display: block;
} }
#toc-toggler {
visibility: hidden;
}
.navbar-collapse.lang-selector { .navbar-collapse.lang-selector {
display: block !important; display: block !important;
position: absolute; position: absolute;
right: 0; right: 0;
top: 0.5rem; top: 0.5rem;
} }
.note-card-holder { .note-card-holder {
margin: 0; margin: 0;
margin-top: 1.5rem; margin-top: 1.5rem;
@ -165,37 +158,36 @@ body.type-notes {
position: relative; position: relative;
transition: all ease-out 0.3s; transition: all ease-out 0.3s;
} }
.content-section.hide .note-card-holder{ .content-section.hide .note-card-holder {
grid-template-columns: repeat(auto-fill, minmax(30rem,1fr)); grid-template-columns: repeat(auto-fill, minmax(30rem, 1fr));
transition: all ease-out 0.3s; transition: all ease-out 0.3s;
} }
} }
/* Large devices (desktops, 992px and up) */ /* Large devices (desktops, 992px and up) */
@media (max-width: 992px) { @media (max-width: 992px) {
.note-card-holder .note-card { .note-card-holder .note-card {
max-width: 100%; max-width: 100%;
min-width: 50%; min-width: 50%;
transition: all ease-out 0.3s; transition: all ease-out 0.3s;
} }
.content-section.hide .note-card-holder .note-card { .content-section.hide .note-card-holder .note-card {
max-width: 100%; max-width: 100%;
min-width: 100%; min-width: 100%;
transition: all ease-out 0.3s; transition: all ease-out 0.3s;
} }
} }
/* Medium devices (tablets, 768px and up) */ /* Medium devices (tablets, 768px and up) */
@media only screen and (max-width: 768px) { @media only screen and (max-width: 768px) {
} }
/* Small devices (landscape phones, 576px and up) */ /* Small devices (landscape phones, 576px and up) */
@media only screen and (max-width: 576px) { @media only screen and (max-width: 576px) {
.wrapper { .wrapper {
padding-left: 0px; padding-left: 0px;
@ -203,33 +195,35 @@ body.type-notes {
flex-flow: column; flex-flow: column;
overflow: hidden; overflow: hidden;
} }
.content-section, .content-section.hide { .content-section,
.content-section.hide {
flex: 100%; flex: 100%;
max-width: 100%; max-width: 100%;
padding-left: 0; padding-left: 0;
width: 100%; width: 100%;
transition: all ease-out 0.3s; transition: all ease-out 0.3s;
} }
.content { .content {
width: 100%; width: 100%;
padding-left: 0; padding-left: 0;
padding-right: 0; padding-right: 0;
transition: all ease-out 0.3s; transition: all ease-out 0.3s;
} }
.content-section.hide .content { .content-section.hide .content {
margin-top: 0; margin-top: 0;
padding-top: 0; padding-top: 0;
transition: all ease-out 0.3s; transition: all ease-out 0.3s;
} }
.content-section.hide .note-card-holder { .content-section.hide .note-card-holder {
margin-top: 0.5rem; margin-top: 0.5rem;
transition: all ease-out 0.3s; transition: all ease-out 0.3s;
} }
.note-card-holder .note-card, .content-section.hide .note-card-holder .note-card { .note-card-holder .note-card,
.content-section.hide .note-card-holder .note-card {
margin-left: 1%; margin-left: 1%;
margin-right: 1%; margin-right: 1%;
max-width: 98%; max-width: 98%;
@ -237,16 +231,16 @@ body.type-notes {
transition: all ease-out 0.3s; transition: all ease-out 0.3s;
} }
} }
/* iPhoneX, iPhone 6,7,8 */ /* iPhoneX, iPhone 6,7,8 */
@media only screen and (max-width: 375px) { @media only screen and (max-width: 375px) {
} }
/* Galaxy S5, Moto G4 */ /* Galaxy S5, Moto G4 */
@media only screen and (max-width: 360px) { @media only screen and (max-width: 360px) {
} }
/* iPhone 5 or before */ /* iPhone 5 or before */
@media only screen and (max-width: 320px) { @media only screen and (max-width: 320px) {
} }
} }

View file

@ -1,10 +1,4 @@
@mixin initial-nav-item-hover-effect() { @mixin nav-item-hover-effect() {
color: #f9fafc;
transition: all 0.3s ease-out;
transform: translateY(-2px);
}
@mixin final-nav-item-hover-effect() {
color: #2098d1 !important; color: #2098d1 !important;
transition: all 0.3s ease-out; transition: all 0.3s ease-out;
border-bottom: 2px solid #2098d1 !important; border-bottom: 2px solid #2098d1 !important;
@ -12,7 +6,53 @@
background: linear-gradient(90deg, rgba(2, 0, 36, 1) 0%, rgba(34, 136, 168, 0.1) 0%); background: linear-gradient(90deg, rgba(2, 0, 36, 1) 0%, rgba(34, 136, 168, 0.1) 0%);
} }
@mixin navbar-dropdown() { .top-navbar {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 50px;
z-index: 99999;
transition: all 0.4s ease-out;
margin: 0px;
padding-top: 0.4rem;
text-align: center;
background-color: #f9fafc;
color: #1c2d41;
transition: all 0.3s ease-out;
.navbar-brand {
color: #1c2d41;
font-weight: 600;
}
.sidebar-icon {
width: 32px;
height: 32px;
filter: invert(0.5);
}
li {
a {
color: #1c2d41;
font-weight: 500;
transition: all 0.3s ease-out;
border-bottom: 2px solid transparent;
&:hover {
@include nav-item-hover-effect();
}
}
}
.navbar-nav .active {
@include nav-item-hover-effect();
}
#top-navbar-divider {
background: rgba(0, 0, 0, 0.6);
}
.dropdown-menu { .dropdown-menu {
box-shadow: 0px 8px 56px rgba(15, 80, 100, 0.16); box-shadow: 0px 8px 56px rgba(15, 80, 100, 0.16);
border: 1px solid #fff; border: 1px solid #fff;
@ -31,74 +71,11 @@
color: #1c2d41 !important; color: #1c2d41 !important;
&:hover { &:hover {
@include final-nav-item-hover-effect(); @include nav-item-hover-effect();
} }
} }
} }
} }
}
.top-navbar {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 50px;
z-index: 99999;
transition: all 0.4s ease-out;
margin: 0px;
padding-top: 0.4rem;
text-align: center;
&.initial-navbar {
background-color: transparent;
.navbar-brand {
color: #c0ccda;
font-weight: 600;
}
li {
a {
color: #c0ccda;
&:hover {
@include initial-nav-item-hover-effect();
}
}
}
.navbar-nav .active {
@include initial-nav-item-hover-effect();
}
@include navbar-dropdown();
}
&.final-navbar {
background-color: #f9fafc;
color: #1c2d41;
transition: all 0.3s ease-out;
.navbar-brand {
color: #1c2d41;
font-weight: 600;
}
li {
a {
color: #1c2d41;
font-weight: 500;
transition: all 0.3s ease-out;
border-bottom: 2px solid#F9FAFC;
&:hover {
@include final-nav-item-hover-effect();
}
}
}
.navbar-nav .active {
@include final-nav-item-hover-effect();
}
#top-navbar-divider {
background: rgba(0, 0, 0, 0.6);
}
@include navbar-dropdown();
}
.navbar-collapse { .navbar-collapse {
margin-top: -5px; margin-top: -5px;
@ -125,6 +102,22 @@
} }
} }
&.transparent-navbar {
background-color: transparent;
.navbar-brand {
color: #c0ccda;
font-weight: 600;
}
li {
a {
color: #c0ccda;
}
}
.feather-menu {
stroke: #8392a5;
}
}
#top-navbar-divider { #top-navbar-divider {
margin-top: 10px; margin-top: 10px;
background: rgba(192, 204, 218, 0.8); background: rgba(192, 204, 218, 0.8);
@ -148,7 +141,7 @@
max-width: 100%; max-width: 100%;
} }
&.initial-navbar { &.transparent-navbar {
.navbar-nav .active, .navbar-nav .active,
li a:hover { li a:hover {
color: #2098d1; color: #2098d1;
@ -194,3 +187,10 @@
} }
} }
} }
.feather-sidebar,
.feather-menu {
width: 1.5rem;
height: 1.5rem;
stroke: #3c4858;
}

View file

@ -87,13 +87,13 @@
&:before { &:before {
content: ''; content: '';
display: block; display: block;
width: 20px; width: 18px;
height: 0; height: 0;
border-top: 1px solid; border-top: 1px solid;
margin-top: -1px; margin-top: -1px;
position: absolute; position: absolute;
top: 18px; top: 18px;
left: -3px; left: -2px;
} }
&:last-child:before { &:last-child:before {
background: #f9fafc; background: #f9fafc;
@ -116,9 +116,9 @@
display: block; display: block;
width: 0; width: 0;
position: absolute; position: absolute;
top: -10px; top: -8px;
left: 0.3rem; left: 6px;
bottom: 0.9rem; bottom: 0.8rem;
border-left: 1px solid; border-left: 1px solid;
} }
} }
@ -247,3 +247,9 @@
} }
} }
} }
.feather-plus-circle,
.feather-minus-circle {
width: 1rem;
height: 1rem;
}

View file

@ -1,5 +1,5 @@
{{ define "navbar" }} {{ define "navbar" }}
{{ partial "navigators/navbar-2.html" (dict "baseURL" site.BaseURL "title" site.Title "hasToggleButton" false) }} {{ partial "navigators/navbar.html" . }}
{{ end }} {{ end }}
{{ define "content" }} {{ define "content" }}

View file

@ -1,5 +1,5 @@
{{ define "navbar" }} {{ define "navbar" }}
{{ partial "navigators/navbar-2.html" . }} {{ partial "navigators/navbar.html" . }}
{{ end }} {{ end }}
{{ define "sidebar" }} {{ define "sidebar" }}

View file

@ -1,5 +1,5 @@
{{ define "navbar" }} {{ define "navbar" }}
{{ partial "navigators/navbar-2.html" . }} {{ partial "navigators/navbar.html" . }}
{{ end }} {{ end }}
{{ define "sidebar" }} {{ define "sidebar" }}

View file

@ -3,7 +3,7 @@
{{ end }} {{ end }}
{{ define "navbar" }} {{ define "navbar" }}
{{ partial "navigators/navbar-2.html" . }} {{ partial "navigators/navbar.html" . }}
{{ end }} {{ end }}
{{ define "sidebar" }} {{ define "sidebar" }}
@ -155,9 +155,6 @@
</div> </div>
<!--scroll back to top--> <!--scroll back to top-->
<a id="scroll-to-top" class="btn"><i class="fas fa-chevron-circle-up"></i></a> <a id="scroll-to-top" class="btn"><i class="fas fa-chevron-circle-up"></i></a>
{{ if .IsTranslated }}
{{ partial "navigators/floating-lang-selector.html" . }}
{{ end }}
</section> </section>
{{ end }} {{ end }}

View file

@ -1,5 +1,5 @@
{{ define "navbar" }} {{ define "navbar" }}
{{ partial "navigators/navbar-2.html" . }} {{ partial "navigators/navbar.html" . }}
{{ end }} {{ end }}
{{ define "sidebar" }} {{ define "sidebar" }}

View file

@ -1,5 +1,5 @@
{{ define "navbar" }} {{ define "navbar" }}
{{ partial "navigators/navbar-2.html" . }} {{ partial "navigators/navbar.html" . }}
{{ end }} {{ end }}
{{ define "sidebar" }} {{ define "sidebar" }}

View file

@ -1,5 +1,5 @@
{{ define "navbar" }} {{ define "navbar" }}
{{ partial "navigators/navbar-2.html" . }} {{ partial "navigators/navbar.html" . }}
{{ end }} {{ end }}
{{ define "sidebar" }} {{ define "sidebar" }}

View file

@ -1,25 +0,0 @@
{{ $pageURL:= .RelPermalink }}
{{ if site.IsMultiLingual }}
{{ $pageURL = strings.TrimPrefix (path.Join "/" .Language.Lang) $pageURL }}
{{ end }}
<div class="dropdown languageSelector">
<a class="btn dropdown-toggle" href="#" id="languageSelector" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{ if ne site.Params.features.flags.enable false }}
{{ $countryCode := partial "helpers/country-code.html" . }}
<span class="flag-icon flag-icon-{{$countryCode}}"></span>
{{ end }}
{{ site.Language.LanguageName }}
</a>
<div class="dropdown-menu" aria-labelledby="languageSelector">
{{ range .Translations }}
<a class="dropdown-item nav-link languages-item" href="{{ path.Join "/" (cond (eq .Language.Lang "en") "" .Language.Lang) $pageURL }}">
{{ if ne site.Params.features.flags.enable false }}
{{ $countryCode := partial "helpers/country-code.html" . }}
<span class="flag-icon flag-icon-{{$countryCode}}"></span>
{{ end }}
{{ .Language.LanguageName }}
</a>
{{ end }}
</div>
</div>

View file

@ -1,25 +0,0 @@
{{ $pageURL:= .RelPermalink }}
{{ if site.IsMultiLingual }}
{{ $pageURL = strings.TrimPrefix (path.Join "/" .Language.Lang) $pageURL }}
{{ end }}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="languageSelector" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{ if ne site.Params.features.flags.enable false }}
{{ $countryCode := partial "helpers/country-code.html" . }}
<span class="flag-icon flag-icon-{{$countryCode}}"></span>
{{ end }}
{{ site.Language.LanguageName }}
</a>
<div class="dropdown-menu" aria-labelledby="languageSelector">
{{ range .Translations }}
<a class="dropdown-item nav-link languages-item" href="{{ path.Join "/" (cond (eq .Language.Lang "en") "" .Language.Lang) $pageURL }}">
{{ if ne site.Params.features.flags.enable false }}
{{ $countryCode := partial "helpers/country-code.html" . }}
<span class="flag-icon flag-icon-{{$countryCode}}"></span>
{{ end }}
{{ .Language.LanguageName }}
</a>
{{ end }}
</div>
</li>

View file

@ -1,63 +0,0 @@
{{/* by default, don't use any logo */}}
{{ $mainLogo := "" }}
{{ $invertedLogo := "" }}
{{/* if custom logo has been provided, use them */}}
{{ if site.Params.logo.main }}
{{ $mainLogo = site.Params.logo.main }}
{{ end }}
{{ if site.Params.logo.inverted }}
{{ $invertedLogo = site.Params.logo.inverted }}
{{ end }}
{{/* resize the logos. don't resize svg because it is not supported */}}
{{ if $mainLogo }}
{{ $mainLogo = resources.Get $mainLogo}}
{{ if and $mainLogo (ne $mainLogo.MediaType.SubType "svg") }}
{{ $mainLogo = $mainLogo.Resize "42x" }}
{{ end }}
{{ $mainLogo = $mainLogo.RelPermalink}}
{{ end }}
{{ if $invertedLogo }}
{{ $invertedLogo = resources.Get $invertedLogo}}
{{ if and $invertedLogo (ne $invertedLogo.MediaType.SubType "svg")}}
{{ $invertedLogo = $invertedLogo.Resize "42x" }}
{{ end }}
{{ $invertedLogo = $invertedLogo.RelPermalink}}
{{ end }}
<nav class="navbar navbar-expand-xl top-navbar final-navbar shadow">
<div class="container">
<button class="navbar-toggler navbar-light" id="sidebar-toggler" type="button">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="{{ site.BaseURL | relLangURL }}">
{{ if $mainLogo }}
<img src="{{ $mainLogo }}" alt="Logo">
{{ end }}
{{- site.Title -}}
</a>
<button class="navbar-toggler navbar-light" id="toc-toggler" type="button">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse lang-selector" id="top-nav-items">
<ul class="navbar-nav ml-auto">
{{ if .IsTranslated }}
{{ partial "navigators/lang-selector-2.html" . }}
{{ end }}
{{ if site.Params.features.darkMode.enable }}
{{ partial "navigators/theme-selector.html" . }}
{{ end }}
</ul>
</div>
</div>
<!-- Store the logo information in a hidden img for the JS -->
{{ if $mainLogo }}
<img src="{{ $mainLogo }}" class="d-none" id="main-logo" alt="Logo">
{{ end }}
{{ if $invertedLogo }}
<img src="{{ $invertedLogo }}" class="d-none" id="inverted-logo" alt="Inverted Logo">
{{ end }}
</nav>

View file

@ -37,6 +37,11 @@
{{ $invertedLogo = $invertedLogo.RelPermalink}} {{ $invertedLogo = $invertedLogo.RelPermalink}}
{{ end }} {{ end }}
{{ $logo := $mainLogo }}
{{ if .IsHome }}
{{ $logo = $invertedLogo }}
{{ end }}
{{ $customMenus := site.Params.customMenus }} {{ $customMenus := site.Params.customMenus }}
{{ if (index site.Data site.Language.Lang).site.customMenus }} {{ if (index site.Data site.Language.Lang).site.customMenus }}
{{ $customMenus = (index site.Data site.Language.Lang).site.customMenus }} {{ $customMenus = (index site.Data site.Language.Lang).site.customMenus }}
@ -47,29 +52,34 @@
{{ $sections = (index site.Data site.Language.Lang).sections }} {{ $sections = (index site.Data site.Language.Lang).sections }}
{{ end }} {{ end }}
<nav class="navbar navbar-expand-xl top-navbar initial-navbar" id="top-navbar"> <nav class="navbar navbar-expand-xl top-navbar shadow {{ if .IsHome}}transparent-navbar homepage{{end}}" id="top-navbar">
<div class="container"> <div class="container">
{{ if not .IsHome }}
<button class="navbar-toggler navbar-light" id="sidebar-toggler" type="button">
<i data-feather="sidebar"></i>
</button>
{{ end }}
<a class="navbar-brand" href="{{ site.BaseURL | relLangURL }}"> <a class="navbar-brand" href="{{ site.BaseURL | relLangURL }}">
{{ if $invertedLogo }} {{ if $logo }}
<img src="{{ $invertedLogo }}" id="logo" alt="Logo"> <img src="{{ $logo }}" id="logo" alt="Logo">
{{ end }} {{ end }}
{{- site.Title -}} {{- site.Title -}}
</a> </a>
<button <button
class="navbar-toggler navbar-dark" class="navbar-toggler {{if .IsHome}}navbar-dark{{else}}navbar-light{{end}}"
id="navbar-toggler" id="navbar-toggler"
type="button" type="button"
data-toggle="collapse" data-toggle="collapse"
data-target="#top-nav-items" data-target="#top-nav-items"
aria-label="menu" aria-label="menu"
> >
<span class="navbar-toggler-icon"></span> <i data-feather="menu"></i>
</button> </button>
<div class="collapse navbar-collapse dynamic-navbar" id="top-nav-items"> <div class="collapse navbar-collapse dynamic-navbar" id="top-nav-items">
<ul class="navbar-nav ml-auto"> <ul class="navbar-nav ml-auto">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="#home">{{ i18n "home" }}</a> <a class="nav-link" href="{{ site.BaseURL | relLangURL }}#home">{{ i18n "home" }}</a>
</li> </li>
{{ if $sections }} {{ if $sections }}
{{ $sectionCount := 1 }} {{ $sectionCount := 1 }}
@ -78,7 +88,7 @@
{{ $sectionCount = add $sectionCount 1}} {{ $sectionCount = add $sectionCount 1}}
{{ if le $sectionCount $maxVisibleSections }} {{ if le $sectionCount $maxVisibleSections }}
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="#{{ partial "helpers/get-section-id.html" . }}">{{ .section.name }}</a> <a class="nav-link" href="{{ site.BaseURL | relLangURL }}#{{ partial "helpers/get-section-id.html" . }}">{{ .section.name }}</a>
</li> </li>
{{ end }} {{ end }}
{{ end }} {{ end }}
@ -92,7 +102,7 @@
{{ if and (.section.enable) (.section.showOnNavbar) }} {{ if and (.section.enable) (.section.showOnNavbar) }}
{{ $sectionCount = add $sectionCount 1}} {{ $sectionCount = add $sectionCount 1}}
{{ if gt $sectionCount $maxVisibleSections }} {{ if gt $sectionCount $maxVisibleSections }}
<a class="dropdown-item" href="#{{ partial "helpers/get-section-id.html" . }}">{{ .section.name }}</a> <a class="dropdown-item" href="{{ site.BaseURL | relLangURL }}#{{ partial "helpers/get-section-id.html" . }}">{{ .section.name }}</a>
{{ end }} {{ end }}
{{ end }} {{ end }}
{{- end }} {{- end }}
@ -106,12 +116,12 @@
{{ end }} {{ end }}
{{ if $blogEnabled }} {{ if $blogEnabled }}
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" id="blog-link" href="{{ "/posts/" | relLangURL }}">{{ i18n "posts" }}</a> <a class="nav-link" id="blog-link" href="{{ path.Join (site.BaseURL | relLangURL) "posts" }}">{{ i18n "posts" }}</a>
</li> </li>
{{ end }} {{ end }}
{{ if $notesEnabled }} {{ if $notesEnabled }}
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" id="note-link" href="{{ "/notes/" | relLangURL }}">{{ i18n "notes" }}</a> <a class="nav-link" id="note-link" href="{{ path.Join (site.BaseURL | relLangURL) "notes" }}">{{ i18n "notes" }}</a>
</li> </li>
{{ end }} {{ end }}
{{ range $customMenus }} {{ range $customMenus }}

View file

@ -1,15 +1,15 @@
{{ range .menuItems }} {{ range .menuItems }}
{{ $class:= "" }} {{ $class:= "" }}
{{ $icon:= "fa-plus-circle" }} {{ $icon:= "plus-circle" }}
<!-- If the current menu is the selected menu or it contain the selected menu, set expand icon and set "active" class --> <!-- If the current menu is the selected menu or it contain the selected menu, set expand icon and set "active" class -->
{{ if or ($.ctx.HasMenuCurrent $.menuName .) ($.ctx.IsMenuCurrent $.menuName .)}} {{ if or ($.ctx.HasMenuCurrent $.menuName .) ($.ctx.IsMenuCurrent $.menuName .)}}
{{ $icon = "fa-minus-circle"}} {{ $icon = "minus-circle"}}
{{ $class = "active" }} {{ $class = "active" }}
{{end}} {{end}}
{{ if .HasChildren }} {{ if .HasChildren }}
<!-- Add current entry --> <!-- Add current entry -->
<li> <li>
<i class="fas {{ $icon }}"></i><a class="{{$class}} list-link" href="{{ .URL }}"> {{.Name}}</a> <i data-feather="{{ $icon }}"></i><a class="{{$class}} list-link" href="{{ .URL }}"> {{.Name}}</a>
<!-- Add sub-tree --> <!-- Add sub-tree -->
<ul class="{{ $class }}"> <ul class="{{ $class }}">
{{ partial "navigators/sidebar.html" (dict "menuName" $.menuName "menuItems" .Children "ctx" $.ctx) }} {{ partial "navigators/sidebar.html" (dict "menuName" $.menuName "menuItems" .Children "ctx" $.ctx) }}

View file

@ -1 +1 @@
{{ partial "helpers/script-bundle.html" }} {{ partial "helpers/script-bundle.html" }}

View file

@ -1,5 +1,5 @@
{{ define "navbar" }} {{ define "navbar" }}
{{ partial "navigators/navbar-2.html" . }} {{ partial "navigators/navbar.html" . }}
{{ end }} {{ end }}
{{ define "sidebar" }} {{ define "sidebar" }}

46
package-lock.json generated
View file

@ -21,11 +21,13 @@
"eslint-plugin-n": "^15.6.0", "eslint-plugin-n": "^15.6.0",
"eslint-plugin-no-jquery": "^2.7.0", "eslint-plugin-no-jquery": "^2.7.0",
"eslint-plugin-promise": "^6.1.1", "eslint-plugin-promise": "^6.1.1",
"feather-icons": "^4.29.1",
"filterizr": "^2.2.4", "filterizr": "^2.2.4",
"flag-icon-css": "^4.1.7", "flag-icon-css": "^4.1.7",
"fuse.js": "^6.6.2", "fuse.js": "^6.6.2",
"highlight.js": "^11.6.0", "highlight.js": "^11.6.0",
"imagesloaded": "^5.0.0", "imagesloaded": "^5.0.0",
"include-media": "^1.4.10",
"ityped": "^1.0.3", "ityped": "^1.0.3",
"katex": "^0.16.3", "katex": "^0.16.3",
"mark.js": "^8.11.1", "mark.js": "^8.11.1",
@ -504,6 +506,12 @@
"fsevents": "~2.3.2" "fsevents": "~2.3.2"
} }
}, },
"node_modules/classnames": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/classnames/-/classnames-2.3.2.tgz",
"integrity": "sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw==",
"dev": true
},
"node_modules/cliui": { "node_modules/cliui": {
"version": "7.0.4", "version": "7.0.4",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
@ -1677,6 +1685,16 @@
"reusify": "^1.0.4" "reusify": "^1.0.4"
} }
}, },
"node_modules/feather-icons": {
"version": "4.29.1",
"resolved": "https://registry.npmjs.org/feather-icons/-/feather-icons-4.29.1.tgz",
"integrity": "sha512-P1we61haGTds6lKWe6CCVPsNULb8tHr1y6S9gXEpU+lNR1Ja7GdV0A1l2hTNmzXv+0Stix/3YMWMAn7n1Qtd6A==",
"dev": true,
"dependencies": {
"classnames": "^2.2.5",
"core-js": "^3.1.3"
}
},
"node_modules/file-entry-cache": { "node_modules/file-entry-cache": {
"version": "6.0.1", "version": "6.0.1",
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz",
@ -2202,6 +2220,12 @@
"node": ">=0.8.19" "node": ">=0.8.19"
} }
}, },
"node_modules/include-media": {
"version": "1.4.10",
"resolved": "https://registry.npmjs.org/include-media/-/include-media-1.4.10.tgz",
"integrity": "sha512-TymQzKF7oWHbItEcEHOCponZ90lRr1I9QbYeD+qCxXy4Z0/pSpS4Ocz2bq3FMOERlXXrY9Sawsh9GjiObVQA6A==",
"dev": true
},
"node_modules/inflight": { "node_modules/inflight": {
"version": "1.0.6", "version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
@ -4134,6 +4158,12 @@
"readdirp": "~3.6.0" "readdirp": "~3.6.0"
} }
}, },
"classnames": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/classnames/-/classnames-2.3.2.tgz",
"integrity": "sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw==",
"dev": true
},
"cliui": { "cliui": {
"version": "7.0.4", "version": "7.0.4",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
@ -5020,6 +5050,16 @@
"reusify": "^1.0.4" "reusify": "^1.0.4"
} }
}, },
"feather-icons": {
"version": "4.29.1",
"resolved": "https://registry.npmjs.org/feather-icons/-/feather-icons-4.29.1.tgz",
"integrity": "sha512-P1we61haGTds6lKWe6CCVPsNULb8tHr1y6S9gXEpU+lNR1Ja7GdV0A1l2hTNmzXv+0Stix/3YMWMAn7n1Qtd6A==",
"dev": true,
"requires": {
"classnames": "^2.2.5",
"core-js": "^3.1.3"
}
},
"file-entry-cache": { "file-entry-cache": {
"version": "6.0.1", "version": "6.0.1",
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz",
@ -5399,6 +5439,12 @@
"integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==",
"dev": true "dev": true
}, },
"include-media": {
"version": "1.4.10",
"resolved": "https://registry.npmjs.org/include-media/-/include-media-1.4.10.tgz",
"integrity": "sha512-TymQzKF7oWHbItEcEHOCponZ90lRr1I9QbYeD+qCxXy4Z0/pSpS4Ocz2bq3FMOERlXXrY9Sawsh9GjiObVQA6A==",
"dev": true
},
"inflight": { "inflight": {
"version": "1.0.6", "version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",

View file

@ -44,6 +44,7 @@
"mermaid": "^9.2.1", "mermaid": "^9.2.1",
"plyr": "^3.7.2", "plyr": "^3.7.2",
"popper.js": "^1.16.1", "popper.js": "^1.16.1",
"include-media": "^1.4.10" "include-media": "^1.4.10",
"feather-icons": "^4.29.1"
} }
} }

View file

@ -18,11 +18,13 @@
"eslint-plugin-n": "project", "eslint-plugin-n": "project",
"eslint-plugin-no-jquery": "project", "eslint-plugin-no-jquery": "project",
"eslint-plugin-promise": "project", "eslint-plugin-promise": "project",
"feather-icons": "project",
"filterizr": "project", "filterizr": "project",
"flag-icon-css": "project", "flag-icon-css": "project",
"fuse.js": "project", "fuse.js": "project",
"highlight.js": "project", "highlight.js": "project",
"imagesloaded": "project", "imagesloaded": "project",
"include-media": "project",
"ityped": "project", "ityped": "project",
"katex": "project", "katex": "project",
"mark.js": "project", "mark.js": "project",
@ -48,11 +50,13 @@
"eslint-plugin-n": "^15.6.0", "eslint-plugin-n": "^15.6.0",
"eslint-plugin-no-jquery": "^2.7.0", "eslint-plugin-no-jquery": "^2.7.0",
"eslint-plugin-promise": "^6.1.1", "eslint-plugin-promise": "^6.1.1",
"feather-icons": "^4.29.1",
"filterizr": "^2.2.4", "filterizr": "^2.2.4",
"flag-icon-css": "^4.1.7", "flag-icon-css": "^4.1.7",
"fuse.js": "^6.6.2", "fuse.js": "^6.6.2",
"highlight.js": "^11.6.0", "highlight.js": "^11.6.0",
"imagesloaded": "^5.0.0", "imagesloaded": "^5.0.0",
"include-media": "^1.4.10",
"ityped": "^1.0.3", "ityped": "^1.0.3",
"katex": "^0.16.3", "katex": "^0.16.3",
"mark.js": "^8.11.1", "mark.js": "^8.11.1",