chore: added back on esc key
a755ff55
1 file(s) · +12 −3
| 1 | 1 | <script lang="ts"> |
|
| 2 | - | import type { PageData } from "./$types"; |
|
| 3 | - | import ProgressiveImage from "$lib/components/ProgressiveImage.svelte"; |
|
| 4 | - | let { data }: { data: PageData } = $props(); |
|
| 2 | + | import type { PageData } from "./$types"; |
|
| 3 | + | import { goto } from "$app/navigation"; |
|
| 4 | + | import ProgressiveImage from "$lib/components/ProgressiveImage.svelte"; |
|
| 5 | + | let { data }: { data: PageData } = $props(); |
|
| 6 | + | ||
| 7 | + | function handleKeydown(event) { |
|
| 8 | + | if (event.key === "Escape") { |
|
| 9 | + | history.back(); |
|
| 10 | + | } |
|
| 11 | + | } |
|
| 5 | 12 | </script> |
|
| 6 | 13 | ||
| 7 | 14 | <svelte:head> |
|
| 27 | 34 | <meta name="twitter:image" content={data.photo.image} /> |
|
| 28 | 35 | <link rel="canonical" href="https://steve.photo/photo/{data.photo.slug}" /> |
|
| 29 | 36 | </svelte:head> |
|
| 37 | + | ||
| 38 | + | <svelte:window on:keydown={handleKeydown} /> |
|
| 30 | 39 | ||
| 31 | 40 | <div class="bg-[#121113] min-h-screen text-white flex flex-col gap-4 pb-4"> |
|
| 32 | 41 | <div class="fixed bg-[#121113] w-full py-4 sm:px-8 px-4"> |
|