mirror of
https://github.com/morten-olsen/morten-olsen.github.io.git
synced 2026-02-08 01:46:28 +01:00
fix: 100 on lighthouse 🥳
This commit is contained in:
@@ -1,36 +1,35 @@
|
|||||||
---
|
---
|
||||||
import { Picture } from "astro:assets";
|
import { Picture } from "astro:assets";
|
||||||
import { data } from "~/data/data";
|
import { data } from "~/data/data";
|
||||||
import { positionWithTeam } from "~/utils/utils.format";
|
|
||||||
|
|
||||||
const currentPath = Astro.url.pathname;
|
const currentPath = Astro.url.pathname;
|
||||||
const { Content, ...profile } = data.profile;
|
const { Content, ...profile } = data.profile;
|
||||||
const currentExperience = await data.experiences.getCurrent()
|
const currentExperience = await data.experiences.getCurrent()
|
||||||
const links = {
|
const links = {
|
||||||
'/': 'Posts',
|
'/': 'Posts',
|
||||||
'/about': 'About',
|
'/about/': 'About',
|
||||||
}
|
}
|
||||||
---
|
---
|
||||||
|
|
||||||
<header class="header">
|
<header class="header">
|
||||||
<div class="image">
|
<a class="image" href="/">
|
||||||
<Picture
|
<Picture
|
||||||
class="picture"
|
class="picture"
|
||||||
alt='Profile Picture'
|
alt='Profile Picture'
|
||||||
src={profile.image}
|
src={profile.image}
|
||||||
fetchpriority="high"
|
fetchpriority="high"
|
||||||
formats={['avif', 'webp', 'jpeg']}
|
formats={['avif', 'webp', 'jpeg']}
|
||||||
width={60}
|
width={120}
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
<div class="info">
|
|
||||||
<a class="name" href="/">{profile.name}</a>
|
|
||||||
{currentExperience && (
|
|
||||||
<a class="work" href="/">
|
|
||||||
{currentExperience.data.position.name} @ {currentExperience.data.company.name}
|
|
||||||
</a>
|
</a>
|
||||||
)}
|
<a class="info" href="/">
|
||||||
|
<div class="name">{profile.name}</div>
|
||||||
|
{currentExperience && (
|
||||||
|
<div class="work">
|
||||||
|
{currentExperience.data.position.name} @ {currentExperience.data.company.name}
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
|
</a>
|
||||||
<div class="links">
|
<div class="links">
|
||||||
{Object.entries(links).map(([target, name]) => (
|
{Object.entries(links).map(([target, name]) => (
|
||||||
<a class={currentPath === target ? 'link active' : 'link'} href={target}>{name}</a>
|
<a class={currentPath === target ? 'link active' : 'link'} href={target}>{name}</a>
|
||||||
@@ -42,6 +41,7 @@ const links = {
|
|||||||
.header {
|
.header {
|
||||||
max-width: var(--content-width);
|
max-width: var(--content-width);
|
||||||
margin: 80px auto;
|
margin: 80px auto;
|
||||||
|
padding: 30px;
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: var(--gap);
|
gap: var(--gap);
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@@ -49,6 +49,25 @@ const schema = JSON.stringify(jsonLd)
|
|||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
<script is:inline>
|
||||||
|
const withFadeIn = document.querySelectorAll('[data-fadein]');
|
||||||
|
|
||||||
|
withFadeIn.forEach((node) => {
|
||||||
|
const observer = new IntersectionObserver((entries) => {
|
||||||
|
entries.forEach(entry => {
|
||||||
|
if (entry.isIntersecting) {
|
||||||
|
node.classList.remove('hidden');
|
||||||
|
node.setAttribute('data-shown', 'true')
|
||||||
|
} else if (!node.hasAttribute('data-shown')) {
|
||||||
|
node.classList.add('hidden');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
observer.observe(node);
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
<style is:global>
|
<style is:global>
|
||||||
|
|
||||||
@view-transition {
|
@view-transition {
|
||||||
|
|||||||
@@ -91,10 +91,9 @@ const jsonLd = await profile.getJsonLd();
|
|||||||
</main>
|
</main>
|
||||||
</Html>
|
</Html>
|
||||||
|
|
||||||
<script src="../scripts/fadein.ts"></script>
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.main {
|
.main {
|
||||||
|
padding: 30px;
|
||||||
max-width: var(--content-width);
|
max-width: var(--content-width);
|
||||||
margin: auto;
|
margin: auto;
|
||||||
display: grid;
|
display: grid;
|
||||||
@@ -109,6 +108,15 @@ const jsonLd = await profile.getJsonLd();
|
|||||||
h2 {
|
h2 {
|
||||||
font-weight: var(--fw-md);
|
font-weight: var(--fw-md);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1024px) {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
grid-template-areas:
|
||||||
|
"content"
|
||||||
|
"profiles"
|
||||||
|
"skills"
|
||||||
|
"experiences";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ const jsonLd = await profile.getJsonLd();
|
|||||||
|
|
||||||
<style>
|
<style>
|
||||||
.main {
|
.main {
|
||||||
|
padding: 30px;
|
||||||
max-width: var(--content-width);
|
max-width: var(--content-width);
|
||||||
margin: auto;
|
margin: auto;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ const { Content } = await render(post);
|
|||||||
<Picture
|
<Picture
|
||||||
loading='eager'
|
loading='eager'
|
||||||
class='img'
|
class='img'
|
||||||
|
fetchpriority="high"
|
||||||
src={post.data.heroImage}
|
src={post.data.heroImage}
|
||||||
widths={[320, 640, 1024, 1400]}
|
widths={[320, 640, 1024, 1400]}
|
||||||
formats={['avif', 'webp', 'png']}
|
formats={['avif', 'webp', 'png']}
|
||||||
@@ -75,7 +76,7 @@ const { Content } = await render(post);
|
|||||||
'. content cover';
|
'. content cover';
|
||||||
}
|
}
|
||||||
|
|
||||||
article :global(picture) {
|
article picture {
|
||||||
grid-area: cover;
|
grid-area: cover;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user