Files
shop/components/CookieBanner.vue
libretech 61a74e649b
build / build (push) Successful in 1m38s
feat(selection): lock single-option boxes, drop the about link
Recovered work in progress that sat uncommitted since 2026-05: a
SelectionBox renders as a plain div instead of a NuxtLink when locked,
so a variant with only one choice reads as decided rather than
clickable, and it reports aria-checked in that state. useProductContent
gained the content lookups the details and index pages now use, the
cookie banner says Schließen instead of Akzeptieren, the Über uns
header entry is gone, and ProductCard's hover shadow no longer relies
on a short-circuit that could yield a non-array.
2026-09-23 22:09:52 +02:00

56 lines
1.5 KiB
Vue

<template>
<div
v-if="consentGiven === false"
class="fixed bottom-0 left-0 right-0 bg-white border-t border-gray-200 shadow-lg px-4 py-3 text-gray-800 z-50 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-4"
>
<p class="text-xs text-gray-600 sm:flex-1">
{{ consentText }}
</p>
<div class="flex items-center gap-2 shrink-0">
<Button
href="/datenschutz"
data-cy="cookie-banner-privacy"
classes="bg-transparent border-transparent py-1.5 px-3 !text-xs !text-black hover:!bg-gray-100 shadow-none"
>
Datenschutzerklärung
</Button>
<Button @click="acceptCookies" data-cy="cookie-banner-accept" classes="bg-gray-800 py-1.5 px-4 !text-xs whitespace-nowrap">
Schließen
</Button>
</div>
</div>
</template>
<script setup lang="ts">
const COOKIE_CONSENT_KEY = "shop:cookie-consent";
const props = withDefaults(
defineProps<{
consentText?: string;
}>(),
{
consentText:
"Wir verwenden notwendige Cookies für die sichere Zahlungsabwicklung. Weitere Informationen finden Sie in unserer Datenschutzerklärung:"
}
);
const emit = defineEmits<{
"consent-given": [];
}>();
// Start with null to prevent SSR flash - banner only renders after client check
const consentGiven = ref<boolean | null>(null);
// Check localStorage only on client
onMounted(() => {
consentGiven.value = !!localStorage.getItem(COOKIE_CONSENT_KEY);
});
function acceptCookies() {
localStorage.setItem(COOKIE_CONSENT_KEY, new Date().toISOString());
consentGiven.value = true;
emit("consent-given");
}
</script>