Compare commits

..

1 Commits

Author SHA1 Message Date
e1bed7cdfd fixed weird padding at bottom of screen 2026-11-16 12:17:27 +00:00
2 changed files with 16 additions and 4 deletions

View File

@@ -97,6 +97,7 @@
if (rows.length !== currentItems.length) return; if (rows.length !== currentItems.length) return;
const containerRect = containerEl.getBoundingClientRect(); const containerRect = containerEl.getBoundingClientRect();
const listRect = listEl.getBoundingClientRect();
nodePositions = rows.map((row) => { nodePositions = rows.map((row) => {
const card = row.children[1] as HTMLElement; const card = row.children[1] as HTMLElement;
@@ -108,7 +109,10 @@
}; };
}); });
graphHeight = containerEl.scrollHeight; // Measure the list instead of the container: the absolutely positioned SVG
// is part of the container's scroll height, which would make graphHeight
// grow and never shrink again when the viewport widens.
graphHeight = listRect.bottom - containerRect.top;
} }
// Initial measurement. // Initial measurement.

View File

@@ -4,6 +4,7 @@
let { items }: { items: ContentItem[] } = $props(); let { items }: { items: ContentItem[] } = $props();
let containerElement: HTMLDivElement; let containerElement: HTMLDivElement;
let listElement = $state<HTMLDivElement>();
let cardElements = $state<HTMLElement[]>([]); let cardElements = $state<HTMLElement[]>([]);
let graphHeight = $state(0); let graphHeight = $state(0);
@@ -14,11 +15,15 @@
const currentItems = items; const currentItems = items;
const cards = cardElements.filter(Boolean); const cards = cardElements.filter(Boolean);
const container = containerElement; const container = containerElement;
const list = listElement;
if (!container || cards.length !== currentItems.length) return; if (!container || !list || cards.length !== currentItems.length) return;
const listEl: HTMLDivElement = list;
function updatePositions() { function updatePositions() {
const containerRect = container.getBoundingClientRect(); const containerRect = container.getBoundingClientRect();
const listRect = listEl.getBoundingClientRect();
nodePositions = cards.map((card) => { nodePositions = cards.map((card) => {
const rect = card.getBoundingClientRect(); const rect = card.getBoundingClientRect();
@@ -29,7 +34,10 @@
}; };
}); });
graphHeight = container.scrollHeight; // Measure the list instead of the container: the absolutely positioned SVG
// is part of the container's scroll height, which would make graphHeight
// grow and never shrink again when the viewport widens.
graphHeight = listRect.bottom - containerRect.top;
} }
// Initial measurement. // Initial measurement.
@@ -90,7 +98,7 @@
</svg> </svg>
<!-- Article list --> <!-- Article list -->
<div class="mt-3 mr-4 grid grid-flow-row auto-rows-min"> <div bind:this={listElement} class="mt-3 mr-4 grid grid-flow-row auto-rows-min">
{#each items as item, index (item.link)} {#each items as item, index (item.link)}
<div <div
class="relative z-10 grid grid-cols-[2rem_minmax(0,1fr)] gap-4 pb-3 max-[600px]:grid-cols-[1.25rem_minmax(0,1fr)] max-[600px]:gap-2" class="relative z-10 grid grid-cols-[2rem_minmax(0,1fr)] gap-4 pb-3 max-[600px]:grid-cols-[1.25rem_minmax(0,1fr)] max-[600px]:gap-2"