layout shifts

This commit is contained in:
Vincent van der Wal
2026-08-01 13:37:04 +02:00
parent 792da49cac
commit fe961a27ae
24 changed files with 427 additions and 210 deletions
+20
View File
@@ -0,0 +1,20 @@
import { getContext } from 'svelte';
import type { Snippet } from 'svelte';
interface HeroContext {
setActions: (snippet: Snippet | null) => void;
}
/**
* Renders a page's own controls into the shared location row that lives in
* `weather/+layout.svelte`. The row itself stays mounted across navigation;
* only the controls swap, and they are cleared when the page unmounts.
*/
export function useHeroActions(actions: Snippet): void {
const hero = getContext<HeroContext>('weather-hero');
$effect(() => {
hero.setActions(actions);
return () => hero.setActions(null);
});
}