Skip to content
Merged
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
679 changes: 511 additions & 168 deletions blocks/header/header.css

Large diffs are not rendered by default.

455 changes: 321 additions & 134 deletions blocks/header/header.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions icons/arrow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions icons/chevron.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions icons/globe.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion icons/search.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 16 additions & 2 deletions scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,19 @@ function decorateButtons(main) {
}
}

/**
* Sets target and rel on links whose hostname differs from the current page.
* @param {Element} container - The element to search for links within
*/
export function decorateExternalLinks(container) {
container.querySelectorAll('a[href]').forEach((link) => {
if (new URL(link.href).hostname !== window.location.hostname) {
link.target = '_blank';
link.rel = 'noopener noreferrer';
}
});
}

/**
* Decorates the main element.
* @param {Element} main The main element
Expand Down Expand Up @@ -187,16 +200,17 @@ async function loadLazy(doc) {
* Loads everything that happens a lot later,
* without impacting the user experience.
*/
function loadDelayed() {
function loadDelayed(doc) {
// eslint-disable-next-line import/no-cycle
window.setTimeout(() => import('./delayed.js'), 3000);
// load anything that can be postponed to the latest here
decorateExternalLinks(doc.querySelector('main'));
}

async function loadPage() {
await loadEager(document);
await loadLazy(document);
loadDelayed();
loadDelayed(document);
}

loadPage();
40 changes: 37 additions & 3 deletions styles/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@
--color-brand: var(--color-yellow);
--color-brand-dark: var(--color-yellow-dark);

/* shadows */
--shadow-s: 0 1px 4px 0 rgb(0 0 0 / 20%);

/* fonts */
--body-font-family: roboto, roboto-fallback, sans-serif;
--text-font-family: roboto, roboto-fallback, sans-serif;
--heading-font-family: roboto-condensed, roboto-condensed-fallback, sans-serif;

/* heading sizes */
Expand Down Expand Up @@ -73,7 +76,7 @@
--space-xl: var(--space-800);

/* layout */
--nav-height: 64px;
--nav-height: 180px;
--site-width: 1200px;

/* border radii */
Expand All @@ -82,6 +85,12 @@
--radius-l: 16px;
}

@media (width >= 1200px) {
:root {
--nav-height: 128px;
}
}

/* fallback fonts */
@font-face {
font-family: roboto-condensed-fallback;
Expand Down Expand Up @@ -109,7 +118,7 @@ body {
margin: 0;
background-color: var(--color-bg);
color: var(--color-text);
font-family: var(--body-font-family);
font-family: var(--text-font-family);
font-size: var(--text-m);
line-height: var(--lh-m);
}
Expand All @@ -118,6 +127,10 @@ body.appear {
display: block;
}

body[data-scroll='disabled'] {
overflow: hidden;
}

header {
height: var(--nav-height);
}
Expand Down Expand Up @@ -241,6 +254,26 @@ img {
width: 100%;
}

.icon.icon-chevron img,
.icon.icon-chevron svg {
transition: transform 0.2s;
}

.icon.arrow-left img,
.icon.arrow-left svg {
transform: rotate(180deg);
}

.icon.chevron-left img,
.icon.chevron-left svg {
transform: rotate(90deg);
}

.icon.chevron-right img,
.icon.chevron-right svg {
transform: rotate(-90deg);
}

/* LINKS */

a:any-link {
Expand All @@ -260,6 +293,7 @@ input,
textarea,
select,
button {
border: 0;
font: inherit;
}

Expand Down