You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

108 lines
3.4 KiB

<script setup lang="ts">
import { cn } from '~/lib/utils'
interface Props {
/**
* Product image URL
*/
image: string
/**
* Product name (e.g., "Makerspace Jahreskarte")
*/
title: string
/**
* Short product description
*/
description?: string
/**
* Price in EUR (will be formatted)
*/
price: number
/**
* Optional badge text (e.g., "Beliebt", "Neu")
*/
badge?: string
/**
* Optional discount percentage
*/
discountPercentage?: number
/**
* Product ID for navigation
*/
productId?: string
/**
* Additional CSS classes
*/
class?: string
}
const props = defineProps<Props>()
// Format price in EUR
const formattedPrice = computed(() => {
return new Intl.NumberFormat('de-DE', {
style: 'currency',
currency: 'EUR',
}).format(props.price)
})
</script>
<template>
<div :class="cn(
'group relative flex flex-col overflow-hidden rounded-2xl bg-white/10 backdrop-blur-lg border border-white/20 shadow-glass transition-all duration-300 hover:scale-[1.02] hover:shadow-2xl hover:border-white/30',
props.class,
)
">
<!-- Badge (optional) -->
<div v-if="badge"
class="absolute left-4 top-4 z-10 rounded-xl bg-experimenta-primary px-3 py-1 text-xs font-bold uppercase tracking-wider text-white shadow-lg">
{{ badge }}
</div>
<!-- Discount Badge (optional) -->
<div v-if="discountPercentage"
class="absolute right-4 top-4 z-10 flex h-12 w-12 items-center justify-center rounded-full bg-red text-white shadow-lg -rotate-12">
<span class="text-sm font-bold">-{{ discountPercentage }}%</span>
</div>
<!-- Product Image -->
<div class="relative aspect-[16/9] w-full overflow-hidden bg-purple-dark">
<img :src="image" :alt="title"
class="h-full w-full object-cover transition-transform duration-500 group-hover:scale-110" />
<!-- Gradient overlay for better text readability -->
<div class="absolute inset-0 bg-gradient-to-t from-purple-darkest/80 via-transparent to-transparent" />
</div>
<!-- Card Content -->
<div class="flex flex-1 flex-col space-y-3 p-5">
<!-- Title -->
<h3 class="text-xl font-bold leading-tight text-white transition-colors group-hover:text-experimenta-accent">
{{ title }}
</h3>
<!-- Description -->
<p v-if="description" class="flex-1 text-sm leading-relaxed text-white/80">
{{ description }}
</p>
<!-- Price & CTA -->
<div class="flex items-center justify-between gap-3 pt-2">
<!-- Price -->
<div class="flex flex-col">
<span class="text-xs uppercase tracking-wide text-white/60">Preis</span>
<span class="text-2xl font-bold text-experimenta-accent">
{{ formattedPrice }}
</span>
</div>
<!-- CTA Button -->
<NuxtLink :to="productId ? `/produkte/${productId}` : '#'"
class="group/btn relative overflow-hidden rounded-xl bg-gradient-button bg-size-300 bg-left px-6 py-3 font-bold text-white shadow-lg transition-all duration-300 hover:bg-right hover:shadow-2xl active:scale-95">
<span class="relative z-10">Details</span>
<div
class="absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent opacity-0 transition-opacity duration-300 group-hover/btn:opacity-100" />
</NuxtLink>
</div>
</div>
</div>
</template>