Skip to content

Commit

Permalink
feat(inscription): add keyboard shortcut to navigate to next/previous…
Browse files Browse the repository at this point in the history
… inscription
  • Loading branch information
jmiguelv committed Jan 24, 2025
1 parent 7530185 commit cb5e34e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions frontend/src/routes/inscription/[slug]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { LucideExternalLink } from 'lucide-svelte';
import { onMount } from 'svelte';
import { DefaultMarker, MapLibre, Popup } from 'svelte-maplibre';
import { goto } from '$app/navigation';
/**
* @typedef {Object} Props
Expand Down Expand Up @@ -112,6 +113,21 @@
}
</script>
<svelte:window
onkeydown={(e) => {
if (e.ctrlKey || e.metaKey) {
if (e.key.toLowerCase() === 'l' || e.key.toLowerCase() === 'h') {
e.preventDefault();
const direction = e.key.toLowerCase() === 'l' ? 1 : -1;
goto(
`${slug.split('0')[0]}${String(Number(slug.split('ISic')[1]) + direction).padStart(6, '0')}`
);
}
}
}}
/>
<article>
<section id="overview">
<div class="overview-header">
Expand Down

0 comments on commit cb5e34e

Please sign in to comment.