Some checks failed
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m7s
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m13s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 3m18s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 3m27s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 4m12s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 4m9s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 3m40s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 3m41s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m5s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
78 lines
3.2 KiB
Vue
78 lines
3.2 KiB
Vue
<script setup>
|
|
import { onMounted, ref } from 'vue';
|
|
import { Link } from '@inertiajs/vue3';
|
|
import { useEventListener, useResizeObserver } from '@vueuse/core';
|
|
import { ChevronLeft, ChevronRight } from '@lucide/vue';
|
|
import AppIcon from '@/components/AppIcon.vue';
|
|
|
|
defineProps({
|
|
links: { type: Array, required: true },
|
|
});
|
|
|
|
const track = ref(null);
|
|
const canScrollLeft = ref(false);
|
|
const canScrollRight = ref(false);
|
|
|
|
function update() {
|
|
const el = track.value;
|
|
|
|
if (!el) return;
|
|
|
|
canScrollLeft.value = el.scrollLeft > 4;
|
|
canScrollRight.value = el.scrollLeft + el.clientWidth < el.scrollWidth - 4;
|
|
}
|
|
|
|
function scroll(direction) {
|
|
track.value?.scrollBy({ left: direction * track.value.clientWidth * 0.8, behavior: 'smooth' });
|
|
}
|
|
|
|
onMounted(update);
|
|
useResizeObserver(track, update);
|
|
useEventListener(track, 'scroll', update, { passive: true });
|
|
</script>
|
|
|
|
<template>
|
|
<!-- Breit (Hauptspalte): wischbare Reihe; schmal (Seitenleiste, Handy): Raster mit drei Spalten -->
|
|
<section class="@container rounded-lg border bg-card">
|
|
<header class="flex items-center justify-between px-5 pt-4 pb-3 @max-md:px-4">
|
|
<h2 class="text-base font-semibold">Schnellzugriff</h2>
|
|
<div v-if="canScrollLeft || canScrollRight" class="flex gap-1.5">
|
|
<button
|
|
type="button"
|
|
class="grid size-7 place-items-center rounded-md border text-foreground/70 hover:bg-accent disabled:opacity-40"
|
|
:disabled="!canScrollLeft"
|
|
aria-label="Zurück"
|
|
@click="scroll(-1)"
|
|
>
|
|
<ChevronLeft class="size-4" />
|
|
</button>
|
|
<button
|
|
type="button"
|
|
class="grid size-7 place-items-center rounded-md border text-foreground/70 hover:bg-accent disabled:opacity-40"
|
|
:disabled="!canScrollRight"
|
|
aria-label="Weiter"
|
|
@click="scroll(1)"
|
|
>
|
|
<ChevronRight class="size-4" />
|
|
</button>
|
|
</div>
|
|
</header>
|
|
<div
|
|
ref="track"
|
|
class="flex snap-x scroll-px-5 gap-3 overflow-x-auto px-5 pb-5 [scrollbar-width:none] @max-md:grid @max-md:grid-cols-3 @max-md:gap-2 @max-md:overflow-visible @max-md:px-4 @max-md:pb-4 [&::-webkit-scrollbar]:hidden"
|
|
>
|
|
<component
|
|
:is="link.url.startsWith('/') && !link.new_tab ? Link : 'a'"
|
|
v-for="link in links"
|
|
:key="link.label + link.url"
|
|
:href="link.url"
|
|
:target="link.new_tab ? '_blank' : undefined"
|
|
:rel="link.new_tab ? 'noopener' : undefined"
|
|
class="flex w-[116px] shrink-0 snap-start flex-col items-center gap-2.5 rounded-md bg-muted px-2 py-4 text-center transition-colors hover:bg-brand-soft @max-md:w-auto @max-md:gap-2 @max-md:px-1.5 @max-md:py-3"
|
|
>
|
|
<AppIcon :name="link.icon || 'link'" class="size-6 text-brand-text" :stroke-width="1.6" />
|
|
<span class="text-xs leading-tight font-medium break-words hyphens-auto">{{ link.label }}</span>
|
|
</component>
|
|
</div>
|
|
</section>
|
|
</template>
|