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 'bootstrap'
import '@fortawesome/fontawesome-free/js/all'
import feather from 'feather-icons'
import './core'
import './features'
import './sections'
import './pages'
feather.replace();

View file

@ -4,8 +4,8 @@ const updateNavBar = () => {
const themeIcon = document.getElementById('navbar-theme-icon-svg')
if (window.scrollY > 40) {
topNavbar?.classList.remove('initial-navbar')
topNavbar?.classList.add('final-navbar', 'shadow')
topNavbar?.classList.remove('transparent-navbar')
topNavbar?.classList.add('shadow')
navbarToggler?.classList.remove('navbar-dark')
navbarToggler?.classList.add('navbar-light')
@ -20,8 +20,8 @@ const updateNavBar = () => {
document.getElementById('logo')?.setAttribute('src', logoURL)
}
} else {
topNavbar?.classList.remove('final-navbar', 'shadow')
topNavbar?.classList.add('initial-navbar')
topNavbar?.classList.remove('shadow')
topNavbar?.classList.add('transparent-navbar')
navbarToggler?.classList.remove('navbar-light')
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,
// 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
// anchors in the mobile nav pop up are clicked
const navMain =document.getElementsByClassName('navbar-collapse')
Array.from(navMain).forEach(function(el) {
const navMain = document.getElementsByClassName('navbar-collapse')
Array.from(navMain).forEach(function (el) {
el.addEventListener('click', function (e) {
if (e.target.tagName === 'A') {
el.classList.add('collapse')
}
})
})
updateNavBar()
})

View file

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

View file

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

View file

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

View file

@ -1,10 +1,4 @@
@mixin initial-nav-item-hover-effect() {
color: #f9fafc;
transition: all 0.3s ease-out;
transform: translateY(-2px);
}
@mixin final-nav-item-hover-effect() {
@mixin nav-item-hover-effect() {
color: #2098d1 !important;
transition: all 0.3s ease-out;
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%);
}
@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 {
box-shadow: 0px 8px 56px rgba(15, 80, 100, 0.16);
border: 1px solid #fff;
@ -31,74 +71,11 @@
color: #1c2d41 !important;
&: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 {
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 {
margin-top: 10px;
background: rgba(192, 204, 218, 0.8);
@ -148,7 +141,7 @@
max-width: 100%;
}
&.initial-navbar {
&.transparent-navbar {
.navbar-nav .active,
li a:hover {
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 {
content: '';
display: block;
width: 20px;
width: 18px;
height: 0;
border-top: 1px solid;
margin-top: -1px;
position: absolute;
top: 18px;
left: -3px;
left: -2px;
}
&:last-child:before {
background: #f9fafc;
@ -116,9 +116,9 @@
display: block;
width: 0;
position: absolute;
top: -10px;
left: 0.3rem;
bottom: 0.9rem;
top: -8px;
left: 6px;
bottom: 0.8rem;
border-left: 1px solid;
}
}
@ -247,3 +247,9 @@
}
}
}
.feather-plus-circle,
.feather-minus-circle {
width: 1rem;
height: 1rem;
}