Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 21 additions & 15 deletions css/components/navbar.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
:root {
--nav-size-base: calc(clamp(40px,4vw,60px) / 1.2) ;
--nav-size-base: calc(clamp(50px,5vw,70px));
}

.nav-logo img {
Expand All @@ -8,17 +8,22 @@
}

.nav-logo {
height: calc(var(--nav-size-base) * 1.3 );
max-width: calc(var(--nav-size-base) * 4 );
height: calc(var(--nav-size-base) / 1.3 );
width: min-content;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
gap: calc(var(--nav-size-base) / 4);
}

nav.header-navbar {
nav.navbar {
width: 100%;
height: auto;
height: var(--nav-size-base);
position: sticky;
top: 0;
left: 0;
z-index: 2;
z-index: 3;
display: flex;
flex-direction: row;
align-content: center;
Expand All @@ -27,9 +32,10 @@ nav.header-navbar {
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
justify-content: space-between;
box-sizing: border-box;
}

nav.header-navbar:before {
nav.navbar:before {
content: "";
display: block;
position: absolute;
Expand All @@ -45,9 +51,9 @@ nav.header-navbar:before {
}

.nav-toggle {
width: var(--nav-size-base);
height: var(--nav-size-base);
gap: calc(var(--nav-size-base) / 12);
width: calc(var(--nav-size-base) / 1.4);
height: calc(var(--nav-size-base) / 1.6);
gap: 10%;
display: flex;
flex-direction: column;
flex-wrap: nowrap;
Expand All @@ -58,10 +64,10 @@ nav.header-navbar:before {

span.nav-line {
display: block;
width: 90%;
height: calc(var(--nav-size-base)/5);
background: var(--neutral-600);
border-radius: 5px;
width: 100%;
height: 25%;
background: var(--neutral-700);
border-radius: 2px;
transition: 50ms;
position: relative;
top: 0;
Expand All @@ -73,7 +79,7 @@ span.nav-line {

.nav-toggle.show #nav-line-3 {
opacity: 0;
top: 20px;
/* top: 20px; */
height: 0;
}

Expand Down
16 changes: 8 additions & 8 deletions css/utils/typography.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
*{
font-size: clamp(0.875rem, 1vw + 0.5rem, 1.125rem);
line-height: 1.6;
line-height: calc(clamp(0.875rem, 1vw + 0.5rem, 1.125rem) + 5px);
-webkit-text-size-adjust: 100%;
font-family: var(--font-sans);
color: var(--neutral-800);
Expand All @@ -11,16 +11,16 @@ h1, h2, h3, h4, h5, h6 {

font-weight: 600;
color: var(--neutral-900);
line-height: 1.2;

}

h1 { font-size: clamp(1.875rem, 2vw + 1rem, 3rem); margin-bottom: var(--space-4); }
h2 { font-size: clamp(1.5rem, 1.5vw + 1rem, 2.25rem); margin-bottom: var(--space-3); }
h3 { font-size: clamp(1.25rem, 1vw + 0.875rem, 1.875rem); margin-bottom: var(--space-3); }
h4 { font-size: clamp(1.125rem, 0.75vw + 0.875rem, 1.5rem); margin-bottom: var(--space-2); }
h5 { font-size: clamp(1rem, 0.5vw + 0.75rem, 1.25rem); margin-bottom: var(--space-2); }
h6 { font-size: clamp(0.875rem, 0.5vw + 0.5rem, 1rem); margin-bottom: var(--space-1); }

h1 { font-size: clamp(1.875rem, 2vw + 1rem, 3rem); line-height:calc( + 5px); margin-bottom: var(--space-4); }
h2 { font-size: clamp(1.5rem, 1.5vw + 1rem, 2.25rem); line-height:calc(clamp(1.5rem, 1.5vw + 1rem, 2.25rem) + 5px); margin-bottom: var(--space-3); }
h3 { font-size: clamp(1.25rem, 1vw + 0.875rem, 1.875rem); line-height:calc(clamp(1.25rem, 1vw + 0.875rem, 1.875rem) + 5px); margin-bottom: var(--space-3); }
h4 { font-size: clamp(1.125rem, 0.75vw + 0.875rem, 1.5rem); line-height:calc(clamp(1.125rem, 0.75vw + 0.875rem, 1.5rem) + 5px); margin-bottom: var(--space-2); }
h5 { font-size: clamp(1rem, 0.5vw + 0.75rem, 1.25rem); line-height:calc(clamp(1rem, 0.5vw + 0.75rem, 1.25rem) + 5px); margin-bottom: var(--space-2); }
h6 { font-size: clamp(0.875rem, 0.5vw + 0.5rem, 1rem); line-height:calc(clamp(0.875rem, 0.5vw + 0.5rem, 1rem) + 5px); margin-bottom: var(--space-1); }

p {
margin-bottom: clamp(var(--space-2), 1vw, var(--space-4));
Expand Down
23 changes: 13 additions & 10 deletions js/components/navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,22 @@ export class Navbar {
this.id = id;
this.nav = document.getElementById(id);
if(!this.nav){ throw new Error(`element "${id}" not found`); }
this.nav.classList.add('header-navbar');
this.nav.classList.add('navbar');

//get logo path/text and remove previous element
//get logo path/text
this.hasLogo = (this.nav.querySelector('img') && this.nav.querySelector('img').src) ? true : false;
this.logoPath = this.hasLogo ? this.nav.querySelector('img').src : undefined;
this.siteTitle = document.querySelector('head title');
this.siteTitle = siteTitle ?? (this.siteTitle ?? 'Lorem Ipsum');
if(this.nav.querySelector('img')){this.nav.querySelector('img').remove();}
this.siteTitle = siteTitle ?? (this.siteTitle.innerText ?? '');


//get menu items
this.hasMenu = this.nav.querySelector('a') ? true : false;
this.pages = [];
this.nav.querySelectorAll('a').forEach((a)=>{

var page = {};
page.href = a.href ?? '#';
page.href = a.href ?? '';
page.text = a.innerText ?? 'Page';
this.pages.push(page);

Expand Down Expand Up @@ -81,11 +81,12 @@ export class Navbar {
logo_cnt.appendChild(logo_img);


}else{
}

logo_cnt.innerText = this.siteTitle;
var logo_txt = document.createElement('span');
logo_txt.innerText = this.siteTitle;
logo_cnt.appendChild(logo_txt);

}

this.nav.appendChild(logo_cnt);

Expand Down Expand Up @@ -123,9 +124,9 @@ export class Navbar {

for(var i = 0; i < this.pages.length; i++){

var li = document.createElement('li')
var li = document.createElement('li');
var a = document.createElement('a');
a.href = this.pages[i].href;
if(this.pages[i].href.length > 0){ a.href = this.pages[i].href; }
a.innerText = this.pages[i].text;
li.appendChild(a);
ul.appendChild(li);
Expand All @@ -142,3 +143,5 @@ export class Navbar {
}


//initialize first available
//document.addEventListener("DOMContentLoaded", () => {let navMain = new Navbar('nav-main');});