1
0
resumarkdown/src/lib/components/nav-item.svelte

39 lines
661 B
Svelte
Raw Normal View History

2024-10-11 01:03:27 -05:00
<script lang="ts">
import { pane, type Pane } from '$lib/stores/nav';
export let destination: Pane;
function handleKey({ key }: KeyboardEvent) {
if (key === ' ' || key === 'Enter' || key === 'Spacebar') {
navigate();
}
}
function navigate() {
pane.set(destination);
}
</script>
<li
2024-10-11 01:27:23 -05:00
aria-controls={`pane-${$pane}`}
aria-selected={destination === $pane}
2024-10-11 01:03:27 -05:00
role="tab"
tabindex="0"
on:click={navigate}
on:keyup={handleKey}
>
<slot />
</li>
2024-10-11 00:23:32 -05:00
<style lang="less">
li {
margin: 0;
padding: @padding-md;
text-align: center;
}
li:not(:last-of-type) {
border-bottom: 1px solid @color-dark;
}
</style>