Loheide-eu-mitarbeiterplatt.../resources/js/components/QuickLinksRow.vue
Friederich Loheide f813a0fff3
Some checks failed
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 58s
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m7s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m4s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m3s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m10s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m8s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m5s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 1m4s
CI / Build-Artefakte aktuell (pull_request) Failing after 41s
Layout nach Intranet-Vorbild: einzeiliger Header, Begrüßungskarte, Schnellzugriff-Leiste
- Header einzeilig mit Navigation neben dem Logo, Suche rechts, mobil als Menü (Sheet)
- Begrüßungskarte mit Foto rechts und Aktionsleiste darunter
- Schnellzugriffe als blätterbare Kachelreihe
- Raster auf Mobilgeräten repariert (Spalten wuchsen mit breitem Inhalt mit)
- Telefonnummern im Admin: übliche deutsche Schreibweisen wie „+49 (0) 30 …“ werden akzeptiert

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 20:58:21 +00:00

74 lines
2.9 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 { quickLinkIcons } from '@/lib/icons';
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>
<section class="rounded-lg border bg-card">
<header class="flex items-center justify-between px-5 pt-4 pb-3">
<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] [&::-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"
>
<component :is="quickLinkIcons[link.icon] ?? quickLinkIcons.link" class="size-6 text-brand-text" :stroke-width="1.6" />
<span class="text-xs leading-tight font-medium">{{ link.label }}</span>
</component>
</div>
</section>
</template>