@brumaombra/ui-vintage 0.8.1 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/COMPONENTS.md +4 -1
  2. package/package.json +2 -2
  3. package/src/components/blog/AllPostsSection.vue +1 -2
  4. package/src/components/blog/BlogContentRenderer.vue +144 -49
  5. package/src/components/blog/BlogFAQSection.vue +13 -15
  6. package/src/components/blog/BlogHeaderSection.vue +27 -9
  7. package/src/components/blog/BlogInfoSection.vue +37 -36
  8. package/src/components/blog/BlogProgressBar.vue +5 -2
  9. package/src/components/blog/BlogSectionTitle.vue +24 -5
  10. package/src/components/blog/BlogTagsSection.vue +8 -5
  11. package/src/components/blog/CategoriesList.vue +2 -2
  12. package/src/components/blog/CategoryCard.vue +25 -16
  13. package/src/components/blog/HeaderCarousel.vue +109 -146
  14. package/src/components/blog/PostCard.vue +34 -35
  15. package/src/components/blog/PostsList.vue +3 -2
  16. package/src/components/blog/SocialShareSidebar.vue +51 -41
  17. package/src/components/blog/TableOfContents.vue +14 -10
  18. package/src/components/content/BlogList.vue +16 -4
  19. package/src/components/content/BlogTable.vue +4 -4
  20. package/src/components/content/CodeBlock.vue +5 -5
  21. package/src/components/content/Flow.vue +4 -4
  22. package/src/components/content/ProseHr.vue +5 -5
  23. package/src/components/content/Terminal.vue +10 -4
  24. package/src/components/landing/landing-footer/LandingFooter.vue +9 -4
  25. package/src/components/landing/landing-navbar/LandingNavbar.vue +47 -51
  26. package/src/components/landing/landing-shell/LandingShell.vue +7 -2
  27. package/src/components/ui/accordion/Accordion.vue +6 -6
  28. package/src/components/ui/breadcrumb/BreadcrumbEllipsis.vue +1 -1
  29. package/src/components/ui/breadcrumb/BreadcrumbLink.vue +1 -1
  30. package/src/components/ui/breadcrumb/BreadcrumbList.vue +1 -1
  31. package/src/components/ui/breadcrumb/BreadcrumbPage.vue +1 -1
  32. package/src/components/ui/breadcrumb/BreadcrumbSeparator.vue +2 -6
  33. package/src/components/ui/card/Card.vue +1 -1
  34. package/src/components/ui/command/CommandItem.vue +2 -2
  35. package/src/i18n/de.json +3 -1
  36. package/src/i18n/en.json +3 -1
  37. package/src/i18n/es.json +3 -1
  38. package/src/i18n/fr.json +3 -1
  39. package/src/i18n/it.json +3 -1
  40. package/src/i18n/ja.json +3 -1
  41. package/src/i18n/pt.json +3 -1
  42. package/src/i18n/ru.json +3 -1
  43. package/src/i18n/zh.json +3 -1
  44. package/src/styles.css +40 -0
@@ -1,7 +1,8 @@
1
1
  <script setup lang="ts">
2
2
  import { NuxtImg } from '#components';
3
- import { Badge } from '../ui/badge';
4
- import { Card, CardContent } from '../ui/card';
3
+ import { ArrowUpRight01Icon } from '@hugeicons/core-free-icons';
4
+ import { HugeiconsIcon } from '@hugeicons/vue';
5
+ import { Card } from '../ui/card';
5
6
 
6
7
  // Props
7
8
  const props = withDefaults(defineProps<{
@@ -14,23 +15,31 @@ const props = withDefaults(defineProps<{
14
15
  </script>
15
16
 
16
17
  <template>
17
- <Card class="p-0! overflow-hidden group cursor-pointer transition-transform duration-300 ease-out hover:-translate-y-1 motion-reduce:transition-none motion-reduce:hover:translate-y-0">
18
- <CardContent class="gap-0 p-0!">
19
- <!-- Background Image -->
20
- <div v-if="props.image" class="relative w-full h-36 overflow-hidden">
21
- <NuxtImg :src="props.image" :alt="props.name" height="225" width="400" format="avif" quality="35" :sizes="{ 480: '480px', 1280: '400px' }" loading="lazy" decoding="async" class="w-full h-full object-cover transition-transform duration-500 group-hover:scale-110" />
22
- </div>
18
+ <Card interactive class="group/category h-full gap-0! overflow-hidden p-0! sm:gap-0!">
19
+ <div class="relative h-40 w-full overflow-hidden bg-surface">
20
+ <!-- Background image -->
21
+ <NuxtImg v-if="props.image" :src="props.image" :alt="props.name" height="225" width="400" format="avif" quality="35" :sizes="{ 480: '480px', 1280: '400px' }" loading="lazy" decoding="async" class="size-full object-cover transition-[scale] duration-700 ease-out-expo group-hover/category:scale-110" />
22
+
23
+ <!-- Fallback when there is no image -->
24
+ <div v-else aria-hidden="true" class="size-full bg-[radial-gradient(circle_at_30%_20%,color-mix(in_oklab,var(--primary)_35%,transparent),transparent_65%)]" />
25
+
26
+ <!-- Legibility shade -->
27
+ <div aria-hidden="true" class="absolute inset-0 bg-linear-to-t from-black/80 via-black/25 to-black/0" />
23
28
 
24
- <!-- Content -->
25
- <div class="p-4 flex items-center justify-between">
26
- <!-- Name -->
27
- <span class="text-sm font-bold text-foreground truncate mr-3">
29
+ <!-- Arrow that appears on hover -->
30
+ <span aria-hidden="true" class="absolute top-3 right-3 flex size-8 scale-75 items-center justify-center rounded border border-white/25 bg-black/30 text-white opacity-0 backdrop-blur-md transition-[opacity,scale] duration-300 ease-spring group-hover/category:scale-100 group-hover/category:opacity-100">
31
+ <HugeiconsIcon :icon="ArrowUpRight01Icon" class="size-4" />
32
+ </span>
33
+
34
+ <!-- Name and count -->
35
+ <div class="absolute inset-x-0 bottom-0 flex items-end justify-between gap-3 p-4">
36
+ <span class="truncate text-base font-bold text-white transition-[translate] duration-300 ease-spring group-hover/category:-translate-y-0.5">
28
37
  {{ props.name }}
29
38
  </span>
30
-
31
- <!-- Count -->
32
- <Badge color="gray" :text="String(props.count)" />
39
+ <span class="shrink-0 rounded-sm border border-white/25 bg-white/15 px-2 py-0.5 text-xs font-bold text-white tabular-nums backdrop-blur-md">
40
+ {{ props.count }}
41
+ </span>
33
42
  </div>
34
- </CardContent>
43
+ </div>
35
44
  </Card>
36
45
  </template>
@@ -1,12 +1,12 @@
1
1
  <script setup lang="ts">
2
2
  import { NuxtImg } from '#components';
3
- import { ref, computed, onMounted, onUnmounted } from 'vue';
3
+ import { computed, onMounted, onUnmounted, ref } from 'vue';
4
4
  import { useI18n } from 'vue-i18n';
5
5
  import { ArrowLeft01Icon, ArrowRight01Icon } from '@hugeicons/core-free-icons';
6
6
  import { HugeiconsIcon } from '@hugeicons/vue';
7
7
  import { Badge } from '../ui/badge';
8
8
  import { Button } from '../ui/button';
9
- import { Card, CardContent } from '../ui/card';
9
+ import { cn } from '../../lib/utils';
10
10
 
11
11
  const { t } = useI18n();
12
12
 
@@ -24,180 +24,143 @@ const props = withDefaults(defineProps<{
24
24
  featuredPosts: () => []
25
25
  });
26
26
 
27
+ const AUTOPLAY_DURATION_MS = 6000;
28
+ const SWIPE_THRESHOLD_PX = 50;
29
+
27
30
  // Carousel state
28
31
  const currentSlide = ref(0);
32
+ const isPaused = ref(false);
33
+ const autoplayEnabled = ref(false);
29
34
  const slideCount = computed(() => props.featuredPosts.length || 0);
30
- const intervalId = ref<ReturnType<typeof setInterval> | null>(null);
31
- const direction = ref<'forward' | 'backward'>('forward');
32
-
33
- // Start auto-play functionality
34
- const startAutoPlay = () => {
35
- intervalId.value = setInterval(nextSlide, 5000);
36
- };
37
-
38
- // Stop auto-play functionality
39
- const stopAutoPlay = () => {
40
- if (intervalId.value) clearInterval(intervalId.value);
41
- };
35
+ let swipeStartX: number | null = null;
42
36
 
43
37
  // Handle next slide press
44
38
  const nextSlide = () => {
45
- direction.value = 'forward';
46
39
  currentSlide.value = (currentSlide.value + 1) % slideCount.value;
47
40
  };
48
41
 
49
42
  // Handle previous slide press
50
43
  const prevSlide = () => {
51
- direction.value = 'backward';
52
44
  currentSlide.value = (currentSlide.value - 1 + slideCount.value) % slideCount.value;
53
45
  };
54
46
 
55
47
  // Go to specific slide
56
48
  const goToSlide = (index: number) => {
57
- // Determine direction
58
- if (index > currentSlide.value) {
59
- direction.value = 'forward';
60
- } else {
61
- direction.value = 'backward';
62
- }
63
-
64
- // Set current slide
65
49
  currentSlide.value = index;
66
50
  };
67
51
 
68
- // Start autoplay when component mounts
52
+ // Pause autoplay while the user hovers, focuses, or leaves the tab
53
+ const pause = () => {
54
+ isPaused.value = true;
55
+ };
56
+ const resume = () => {
57
+ isPaused.value = false;
58
+ };
59
+ const handleVisibilityChange = () => {
60
+ isPaused.value = document.visibilityState !== 'visible';
61
+ };
62
+
63
+ // Keyboard navigation
64
+ const handleKeydown = (event: KeyboardEvent) => {
65
+ if (event.key === 'ArrowRight') nextSlide();
66
+ if (event.key === 'ArrowLeft') prevSlide();
67
+ };
68
+
69
+ // Swipe navigation on touch devices
70
+ const handlePointerDown = (event: PointerEvent) => {
71
+ if (event.pointerType !== 'mouse') swipeStartX = event.clientX;
72
+ };
73
+ const handlePointerUp = (event: PointerEvent) => {
74
+ if (swipeStartX === null) return;
75
+ const deltaX = event.clientX - swipeStartX;
76
+ swipeStartX = null;
77
+ if (Math.abs(deltaX) < SWIPE_THRESHOLD_PX) return;
78
+ if (deltaX < 0) nextSlide();
79
+ else prevSlide();
80
+ };
81
+
82
+ // Autoplay is driven by the progress animation of the active indicator, so the bar and the slide change always stay in sync
83
+ const handleProgressEnd = () => {
84
+ if (autoplayEnabled.value) nextSlide();
85
+ };
86
+
87
+ // Start autoplay when component mounts (never with reduced motion)
69
88
  onMounted(() => {
70
- startAutoPlay();
89
+ autoplayEnabled.value = slideCount.value > 1 && !window.matchMedia?.('(prefers-reduced-motion: reduce)').matches;
90
+ document.addEventListener('visibilitychange', handleVisibilityChange);
71
91
  });
72
92
 
73
- // Clean up interval when component unmounts
93
+ // Clean up listeners when component unmounts
74
94
  onUnmounted(() => {
75
- stopAutoPlay();
95
+ document.removeEventListener('visibilitychange', handleVisibilityChange);
76
96
  });
77
97
  </script>
78
98
 
79
99
  <template>
80
- <div v-if="props.featuredPosts.length > 0" class="relative" @mouseenter="stopAutoPlay" @mouseleave="startAutoPlay">
81
- <!-- Slides -->
82
- <div class="relative overflow-hidden rounded">
83
- <TransitionGroup name="slide">
84
- <div v-for="(post, index) in props.featuredPosts" :id="`carousel-slide-${index}`" :key="post.path || post.title || index" v-show="currentSlide === index" class="w-full" :data-direction="direction">
85
- <Card class="p-0! overflow-hidden cursor-pointer">
86
- <CardContent class="gap-0 p-0!">
87
- <!-- Slide image -->
100
+ <div v-if="props.featuredPosts.length > 0" role="region" aria-roledescription="carousel" :aria-label="t('uiVintage.blog.carouselNavigation')" class="group/carousel relative isolate overflow-hidden rounded border border-border bg-card shadow-elevated-lg outline-none focus-visible:ring-[3px] focus-visible:ring-ring/45" tabindex="0" @mouseenter="pause" @mouseleave="resume" @focusin="pause" @focusout="resume" @keydown="handleKeydown" @pointerdown="handlePointerDown" @pointerup="handlePointerUp">
101
+ <!-- Slides (stacked; the active one crossfades in) -->
102
+ <div class="relative h-[28rem] w-full md:h-[32rem]">
103
+ <div v-for="(post, index) in props.featuredPosts" :id="`carousel-slide-${index}`" :key="post.path || post.title || index" role="group" aria-roledescription="slide" :aria-label="`${index + 1} / ${slideCount}`" :aria-hidden="currentSlide !== index" :inert="currentSlide !== index || undefined" :class="cn('absolute inset-0 transition-[opacity,scale] duration-700 ease-out-expo', currentSlide === index ? 'z-10 scale-100 opacity-100' : 'z-0 scale-[1.02] opacity-0')">
104
+ <!-- Slide image with a slow zoom -->
105
+ <NuxtLink :to="post.path" tabindex="-1" aria-hidden="true" class="absolute inset-0 overflow-hidden">
106
+ <NuxtImg v-if="post.image" :src="post.image" :alt="post.title" width="1200" height="640" format="avif" quality="45" :sizes="{ 480: '480px', 1536: '1152px' }" :loading="index === 0 ? 'eager' : 'lazy'" :fetchpriority="index === 0 ? 'high' : 'auto'" :preload="index === 0" :class="cn('size-full object-cover', currentSlide === index && 'animate-uv-ken-burns')" />
107
+ <div v-else class="size-full bg-[radial-gradient(circle_at_20%_20%,color-mix(in_oklab,var(--primary)_45%,transparent),transparent_60%)] bg-surface" />
108
+ </NuxtLink>
109
+
110
+ <!-- Legibility shade -->
111
+ <div aria-hidden="true" class="pointer-events-none absolute inset-0 bg-linear-to-t from-black/90 via-black/45 to-black/5" />
112
+ <div aria-hidden="true" class="pointer-events-none absolute inset-0 bg-linear-to-r from-black/50 via-transparent to-transparent" />
113
+
114
+ <!-- Slide content (replays its entrance every time the slide becomes active) -->
115
+ <div class="absolute inset-x-0 bottom-0 flex flex-col gap-4 p-6 pb-20 text-white md:max-w-3xl md:p-10 md:pb-24">
116
+ <!-- Category badge -->
117
+ <NuxtLink v-if="post.categoryText && post.categoryPath" :to="post.categoryPath" :class="cn('w-fit', currentSlide === index && 'animate-uv-fade-up')">
118
+ <Badge :text="post.categoryText" pulse class="border-white/25 bg-white/15 text-white backdrop-blur-md transition-colors hover:bg-white/25" />
119
+ </NuxtLink>
120
+
121
+ <!-- Title -->
122
+ <NuxtLink :to="post.path" :class="cn('outline-none', currentSlide === index && 'animate-uv-fade-up [animation-delay:90ms]')">
123
+ <h3 class="line-clamp-3 text-2xl leading-tight font-bold tracking-tight text-balance drop-shadow-sm md:text-5xl">
124
+ {{ post.title }}
125
+ </h3>
126
+ </NuxtLink>
127
+
128
+ <!-- Description -->
129
+ <p v-if="post.description" :class="cn('line-clamp-2 max-w-2xl text-xs leading-relaxed text-white/80 md:text-base', currentSlide === index && 'animate-uv-fade-up [animation-delay:180ms]')">
130
+ {{ post.description }}
131
+ </p>
132
+
133
+ <!-- Read post button -->
134
+ <div :class="cn(currentSlide === index && 'animate-uv-fade-up [animation-delay:260ms]')">
135
+ <Button as-child size="lg" class="group/cta">
88
136
  <NuxtLink :to="post.path">
89
- <div class="relative w-full h-56 md:h-80 overflow-hidden">
90
- <NuxtImg :src="post.image" :alt="post.title" width="560" height="315" format="avif" quality="35" :sizes="{ 480: '480px', 1536: '1086px' }" :loading="index === 0 ? 'eager' : 'lazy'" :fetchpriority="index === 0 ? 'high' : 'auto'" :preload="index === 0" class="w-full h-full object-cover transition-transform duration-500 hover:scale-105" />
91
- </div>
137
+ {{ t('uiVintage.blog.goToPost') }}
138
+ <HugeiconsIcon :icon="ArrowRight01Icon" class="size-4 transition-[translate] duration-300 ease-spring group-hover/cta:translate-x-1" />
92
139
  </NuxtLink>
93
-
94
- <!-- Slide content -->
95
- <div class="p-6 md:p-8">
96
- <!-- Category badge -->
97
- <NuxtLink v-if="post.categoryText && post.categoryPath" :to="post.categoryPath" class="inline-block mb-3">
98
- <Badge color="gray" :text="post.categoryText" />
99
- </NuxtLink>
100
-
101
- <!-- Title -->
102
- <NuxtLink :to="post.path">
103
- <h3 class="text-base md:text-3xl font-bold text-foreground mb-3 line-clamp-2 hover:opacity-75 transition-opacity duration-200">
104
- {{ post.title }}
105
- </h3>
106
- </NuxtLink>
107
-
108
- <!-- Description -->
109
- <p class="text-xs md:text-base! text-muted-foreground mb-6 line-clamp-2 leading-relaxed">
110
- {{ post.description }}
111
- </p>
112
-
113
- <!-- Button + indicators row -->
114
- <div class="flex flex-col gap-6 sm:flex-row sm:items-center sm:justify-between">
115
- <!-- Read post button -->
116
- <NuxtLink :to="post.path">
117
- <Button variant="primary" class="w-full sm:w-auto">
118
- <HugeiconsIcon :icon="ArrowRight01Icon" class="size-4" />
119
- {{ t('uiVintage.blog.goToPost') }}
120
- </Button>
121
- </NuxtLink>
122
-
123
- <!-- Slide indicators -->
124
- <div v-if="props.featuredPosts.length > 1" class="flex w-full justify-center gap-3 sm:w-auto" role="tablist" :aria-label="t('uiVintage.blog.carouselNavigation')">
125
- <button v-for="(_, idx) in props.featuredPosts"
126
- :key="idx"
127
- @click="goToSlide(idx)"
128
- :class="['h-5 w-5 sm:h-4! sm:w-4! shrink-0 rounded-[2px] transition-all duration-300 cursor-pointer bg-(--border-light) dark:bg-(--border-dark)', currentSlide === idx ? 'w-8! sm:w-7! bg-(--text-primary-light)! dark:bg-(--text-primary-dark)!' : '']"
129
- :aria-label="t('uiVintage.blog.goToSlide', { index: idx + 1 })"
130
- :aria-current="currentSlide === idx"
131
- role="tab"
132
- :aria-controls="`carousel-slide-${idx}`">
133
- </button>
134
- </div>
135
- </div>
136
- </div>
137
- </CardContent>
138
- </Card>
140
+ </Button>
141
+ </div>
139
142
  </div>
140
- </TransitionGroup>
143
+ </div>
141
144
  </div>
142
145
 
143
- <!-- Previous slide -->
144
- <button v-if="props.featuredPosts.length > 1"
145
- @click="prevSlide"
146
- :aria-label="t('uiVintage.blog.previousSlide')"
147
- class="absolute left-2 top-[calc(50%-4rem)] -translate-y-1/2 z-10 border border-border bg-card px-3 py-3 rounded-[3px] transition-colors duration-200 hover:border-border-strong cursor-pointer">
148
- <HugeiconsIcon :icon="ArrowLeft01Icon" class="size-4 text-muted-foreground" />
149
- </button>
150
-
151
- <!-- Next slide -->
152
- <button v-if="props.featuredPosts.length > 1"
153
- @click="nextSlide"
154
- :aria-label="t('uiVintage.blog.nextSlide')"
155
- class="absolute right-2 top-[calc(50%-4rem)] -translate-y-1/2 z-10 border border-border bg-card px-3 py-3 rounded-[3px] transition-colors duration-200 hover:border-border-strong cursor-pointer">
156
- <HugeiconsIcon :icon="ArrowRight01Icon" class="size-4 text-muted-foreground" />
157
- </button>
146
+ <!-- Controls bar -->
147
+ <div v-if="slideCount > 1" class="absolute inset-x-0 bottom-0 z-20 flex items-center justify-between gap-4 p-6 md:px-10 md:pb-8">
148
+ <!-- Slide indicators (the active one fills up until the next slide) -->
149
+ <div class="flex items-center gap-2" role="tablist" :aria-label="t('uiVintage.blog.carouselNavigation')">
150
+ <button v-for="(_, index) in props.featuredPosts" :key="index" type="button" role="tab" :aria-selected="currentSlide === index" :aria-controls="`carousel-slide-${index}`" :aria-label="t('uiVintage.blog.goToSlide', { index: index + 1 })" :class="cn('relative h-1.5 cursor-pointer overflow-hidden rounded-full bg-white/30 outline-none transition-[width,background-color] duration-500 ease-spring hover:bg-white/50 focus-visible:ring-2 focus-visible:ring-white', currentSlide === index ? 'w-12' : 'w-4')" @click="goToSlide(index)">
151
+ <span v-if="currentSlide === index" :key="`progress-${currentSlide}`" class="absolute inset-0 origin-left rounded-full bg-primary" :style="autoplayEnabled ? { animation: `uv-grow-x ${AUTOPLAY_DURATION_MS}ms linear both`, animationPlayState: isPaused ? 'paused' : 'running' } : undefined" @animationend="handleProgressEnd" />
152
+ </button>
153
+ </div>
154
+
155
+ <!-- Previous and next buttons -->
156
+ <div class="flex items-center gap-2">
157
+ <button type="button" :aria-label="t('uiVintage.blog.previousSlide')" class="flex size-10 cursor-pointer items-center justify-center rounded border border-white/25 bg-black/30 text-white backdrop-blur-md outline-none [transition:background-color_150ms,scale_300ms_var(--ease-spring)] hover:bg-white/20 active:scale-90 focus-visible:ring-2 focus-visible:ring-white" @click="prevSlide">
158
+ <HugeiconsIcon :icon="ArrowLeft01Icon" class="size-4" />
159
+ </button>
160
+ <button type="button" :aria-label="t('uiVintage.blog.nextSlide')" class="flex size-10 cursor-pointer items-center justify-center rounded border border-white/25 bg-black/30 text-white backdrop-blur-md outline-none [transition:background-color_150ms,scale_300ms_var(--ease-spring)] hover:bg-white/20 active:scale-90 focus-visible:ring-2 focus-visible:ring-white" @click="nextSlide">
161
+ <HugeiconsIcon :icon="ArrowRight01Icon" class="size-4" />
162
+ </button>
163
+ </div>
164
+ </div>
158
165
  </div>
159
- </template>
160
-
161
- <style scoped>
162
- .slide-enter-active,
163
- .slide-leave-active {
164
- transition: transform 0.75s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.75s cubic-bezier(0.22, 1, 0.36, 1), filter 0.75s cubic-bezier(0.22, 1, 0.36, 1);
165
- will-change: transform, opacity, filter;
166
- }
167
-
168
- .slide-enter-from[data-direction="forward"] {
169
- opacity: 0;
170
- transform: translateX(12%) scale(0.985);
171
- filter: blur(4px);
172
- }
173
-
174
- .slide-leave-to[data-direction="forward"] {
175
- opacity: 0;
176
- transform: translateX(-12%) scale(0.985);
177
- filter: blur(4px);
178
- }
179
-
180
- .slide-enter-from[data-direction="backward"] {
181
- opacity: 0;
182
- transform: translateX(-12%) scale(0.985);
183
- filter: blur(4px);
184
- }
185
-
186
- .slide-leave-to[data-direction="backward"] {
187
- opacity: 0;
188
- transform: translateX(12%) scale(0.985);
189
- filter: blur(4px);
190
- }
191
-
192
- .slide-leave-active {
193
- position: absolute;
194
- width: 100%;
195
- }
196
-
197
- .slide-enter-to,
198
- .slide-leave-from {
199
- opacity: 1;
200
- transform: translateX(0) scale(1);
201
- filter: blur(0);
202
- }
203
- </style>
166
+ </template>
@@ -4,8 +4,7 @@ import { useI18n } from 'vue-i18n';
4
4
  import { ArrowRight01Icon } from '@hugeicons/core-free-icons';
5
5
  import { HugeiconsIcon } from '@hugeicons/vue';
6
6
  import { Badge } from '../ui/badge';
7
- import { Button } from '../ui/button';
8
- import { Card, CardContent } from '../ui/card';
7
+ import { Card } from '../ui/card';
9
8
 
10
9
  const { t } = useI18n();
11
10
 
@@ -24,38 +23,38 @@ const props = withDefaults(defineProps<{
24
23
  </script>
25
24
 
26
25
  <template>
27
- <Card class="p-0! overflow-hidden group cursor-pointer transition-transform duration-300 ease-out hover:-translate-y-1 motion-reduce:transition-none motion-reduce:hover:translate-y-0">
28
- <CardContent class="h-full gap-0 p-0!">
29
- <!-- Featured image -->
30
- <div v-if="props.image" class="relative w-full h-48 overflow-hidden">
31
- <NuxtImg :src="props.image" :alt="props.title" height="225" width="400" format="avif" quality="35" :sizes="{ 480: '480px', 1280: '400px' }" loading="lazy" decoding="async" class="w-full h-full object-cover transition-transform duration-500 group-hover:scale-110" />
32
- </div>
33
-
34
- <!-- Content -->
35
- <div class="p-6 flex flex-col grow">
36
- <!-- Category Badge -->
37
- <div v-if="props.category" class="mb-3">
38
- <Badge color="gray" :text="props.category" />
39
- </div>
40
-
41
- <!-- Post Title -->
42
- <h2 class="text-base font-bold text-foreground mb-2 line-clamp-2">
43
- {{ props.title }}
44
- </h2>
45
-
46
- <!-- Post Description -->
47
- <p class="text-xs md:text-sm text-muted-foreground leading-relaxed mb-4 line-clamp-3 grow">
48
- {{ props.description }}
49
- </p>
50
-
51
- <!-- Read More Button -->
52
- <div class="mt-auto">
53
- <Button variant="primary" class="w-full sm:w-auto">
54
- <HugeiconsIcon :icon="ArrowRight01Icon" class="size-4" />
55
- {{ t('uiVintage.blog.readMore') }}
56
- </Button>
57
- </div>
58
- </div>
59
- </CardContent>
26
+ <Card interactive class="group/post h-full gap-0! overflow-hidden p-0! sm:gap-0!">
27
+ <!-- Featured image -->
28
+ <div v-if="props.image" class="relative aspect-video w-full overflow-hidden border-b border-border bg-surface">
29
+ <NuxtImg :src="props.image" :alt="props.title" height="225" width="400" format="avif" quality="35" :sizes="{ 480: '480px', 1280: '400px' }" loading="lazy" decoding="async" class="size-full object-cover transition-[scale,filter] duration-700 ease-out-expo group-hover/post:scale-[1.06] group-hover/post:saturate-125" />
30
+
31
+ <!-- Shade that deepens on hover -->
32
+ <div aria-hidden="true" class="absolute inset-0 bg-linear-to-t from-black/45 via-black/0 to-black/0 opacity-60 transition-opacity duration-500 group-hover/post:opacity-100" />
33
+
34
+ <!-- Category over the image -->
35
+ <Badge v-if="props.category" :text="props.category" class="absolute top-3 left-3 border-white/25 bg-black/35 text-white backdrop-blur-md" />
36
+ </div>
37
+
38
+ <!-- Content -->
39
+ <div class="flex grow flex-col gap-3 p-5 sm:p-6">
40
+ <!-- Category (when there is no image to sit on) -->
41
+ <Badge v-if="props.category && !props.image" :text="props.category" />
42
+
43
+ <!-- Post title -->
44
+ <h2 class="line-clamp-2 text-base leading-snug font-bold text-foreground transition-colors duration-200 group-hover/post:text-primary">
45
+ {{ props.title }}
46
+ </h2>
47
+
48
+ <!-- Post description -->
49
+ <p class="line-clamp-3 grow text-xs leading-relaxed text-muted-foreground md:text-sm">
50
+ {{ props.description }}
51
+ </p>
52
+
53
+ <!-- Read more -->
54
+ <span class="mt-2 inline-flex items-center gap-1.5 text-xs font-semibold text-primary sm:text-sm">
55
+ {{ t('uiVintage.blog.readMore') }}
56
+ <HugeiconsIcon :icon="ArrowRight01Icon" class="size-4 transition-[translate] duration-300 ease-spring group-hover/post:translate-x-1" />
57
+ </span>
58
+ </div>
60
59
  </Card>
61
60
  </template>
@@ -17,8 +17,9 @@ const props = withDefaults(defineProps<{
17
17
  </script>
18
18
 
19
19
  <template>
20
- <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
21
- <NuxtLink v-for="(post, index) in props.posts" :key="post.path" :to="post.path" class="block h-full" data-aos="fade-up" :data-aos-delay="(index % 3) * 200">
20
+ <div class="grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3">
21
+ <!-- Post cards rise in row by row as they scroll into view -->
22
+ <NuxtLink v-for="(post, index) in props.posts" :key="post.path" data-aos="blur-up" :data-aos-delay="(index % 3) * 90" :to="post.path" class="block h-full rounded outline-none focus-visible:ring-[3px] focus-visible:ring-ring/45">
22
23
  <PostCard class="h-full" :image="post.image" :category="post.categoryText" :title="post.title" :description="post.description" />
23
24
  </NuxtLink>
24
25
  </div>
@@ -1,9 +1,8 @@
1
1
  <script setup lang="ts">
2
- import { computed } from 'vue';
2
+ import { computed, ref } from 'vue';
3
3
  import { useI18n } from 'vue-i18n';
4
- import { Facebook01Icon, Linkedin01Icon, NewTwitterIcon, Share08Icon, TelegramIcon, WhatsappIcon } from '@hugeicons/core-free-icons';
4
+ import { Facebook01Icon, Link01Icon, Linkedin01Icon, NewTwitterIcon, Share08Icon, TelegramIcon, Tick02Icon, WhatsappIcon } from '@hugeicons/core-free-icons';
5
5
  import { HugeiconsIcon } from '@hugeicons/vue';
6
- import { Card, CardContent } from '../ui/card';
7
6
 
8
7
  // Props
9
8
  const props = defineProps<{
@@ -12,8 +11,9 @@ const props = defineProps<{
12
11
  }>();
13
12
 
14
13
  const { t } = useI18n();
14
+ const copied = ref(false);
15
15
 
16
- // Social platforms config
16
+ // Social platforms config (each one lights up in its brand color on hover)
17
17
  const socialPlatforms = computed(() => {
18
18
  const encodedUrl = encodeURIComponent(props.url);
19
19
  const encodedTitle = encodeURIComponent(props.title);
@@ -22,75 +22,85 @@ const socialPlatforms = computed(() => {
22
22
  name: 'facebook',
23
23
  url: `https://www.facebook.com/sharer/sharer.php?u=${encodedUrl}`,
24
24
  icon: Facebook01Icon,
25
- color: 'bg-blue-700 hover:bg-blue-800',
25
+ color: 'hover:border-[#1877F2] hover:bg-[#1877F2]',
26
26
  label: t('uiVintage.blog.share.facebook')
27
27
  }, {
28
28
  name: 'twitter',
29
29
  url: `https://twitter.com/intent/tweet?url=${encodedUrl}&text=${encodedTitle}`,
30
30
  icon: NewTwitterIcon,
31
- color: 'bg-black hover:bg-gray-800',
31
+ color: 'hover:border-foreground hover:bg-foreground hover:text-background!',
32
32
  label: t('uiVintage.blog.share.x')
33
33
  }, {
34
34
  name: 'whatsapp',
35
35
  url: `https://api.whatsapp.com/send?text=${encodedTitle}%20${encodedUrl}`,
36
36
  icon: WhatsappIcon,
37
- color: 'bg-green-500 hover:bg-green-600',
37
+ color: 'hover:border-[#25D366] hover:bg-[#25D366]',
38
38
  label: t('uiVintage.blog.share.whatsapp')
39
39
  }, {
40
40
  name: 'linkedin',
41
41
  url: `https://www.linkedin.com/sharing/share-offsite/?url=${encodedUrl}`,
42
42
  icon: Linkedin01Icon,
43
- color: 'bg-blue-700 hover:bg-blue-800',
43
+ color: 'hover:border-[#0A66C2] hover:bg-[#0A66C2]',
44
44
  label: t('uiVintage.blog.share.linkedin')
45
45
  }, {
46
46
  name: 'telegram',
47
47
  url: `https://t.me/share/url?url=${encodedUrl}&text=${encodedTitle}`,
48
48
  icon: TelegramIcon,
49
- color: 'bg-blue-400 hover:bg-blue-500',
49
+ color: 'hover:border-[#229ED9] hover:bg-[#229ED9]',
50
50
  label: t('uiVintage.blog.share.telegram')
51
51
  }];
52
52
  });
53
+
54
+ // Shared button classes
55
+ const buttonClasses = 'flex size-10 cursor-pointer items-center justify-center rounded border border-border bg-secondary text-muted-foreground shadow-elevated-sm outline-none [transition:background-color_150ms,border-color_150ms,color_150ms,scale_300ms_var(--ease-spring)] hover:scale-110 hover:text-white active:scale-95 focus-visible:ring-[3px] focus-visible:ring-ring/45';
56
+
57
+ // Copy the article link to the clipboard
58
+ const copyLink = async () => {
59
+ if (!navigator.clipboard) return;
60
+ await navigator.clipboard.writeText(props.url);
61
+ copied.value = true;
62
+ window.setTimeout(() => {
63
+ copied.value = false;
64
+ }, 1800);
65
+ };
53
66
  </script>
54
67
 
55
68
  <template>
56
69
  <Teleport to="body">
57
70
  <!-- Desktop sidebar on the right -->
58
- <div class="fixed right-[max(6.875rem,calc(50%-38.125rem))] top-35 z-20 hidden xl:block 2xl:right-[max(0rem,calc(50%-35.125rem))]">
59
- <Card class="p-5! flex flex-col space-y-4 items-center">
60
- <CardContent class="p-0! gap-4 items-center">
61
- <!-- Share icon -->
62
- <HugeiconsIcon :icon="Share08Icon" class="size-5 text-muted-foreground mb-2" />
71
+ <div class="fixed top-35 right-[max(6.875rem,calc(50%-38.125rem))] z-20 hidden animate-[uv-fade-up_0.7s_var(--ease-out-expo)_0.6s_both] xl:block 2xl:right-[max(0rem,calc(50%-35.125rem))]">
72
+ <div class="flex flex-col items-center gap-3 rounded border border-border bg-card p-3 shadow-elevated-sm">
73
+ <!-- Share icon -->
74
+ <HugeiconsIcon :icon="Share08Icon" class="mb-1 size-5 text-primary" />
63
75
 
64
- <!-- Social share links (desktop) -->
65
- <template v-for="platform in socialPlatforms" :key="platform.name">
66
- <NuxtLink :to="platform.url"
67
- target="_blank"
68
- rel="noopener noreferrer"
69
- :aria-label="platform.label"
70
- :class="['w-10 h-10 rounded flex items-center justify-center text-white transition-all duration-200 hover:opacity-80 hover:scale-105', platform.color]">
71
- <HugeiconsIcon :icon="platform.icon" class="size-4" />
72
- </NuxtLink>
73
- </template>
74
- </CardContent>
75
- </Card>
76
+ <!-- Social share links (desktop) -->
77
+ <a v-for="platform in socialPlatforms" :key="platform.name" :href="platform.url" target="_blank" rel="noopener noreferrer" :aria-label="platform.label" :title="platform.label" :class="[buttonClasses, platform.color]">
78
+ <HugeiconsIcon :icon="platform.icon" class="size-4" />
79
+ </a>
80
+
81
+ <!-- Copy link -->
82
+ <div class="my-1 h-px w-6 bg-border" />
83
+ <button type="button" :aria-label="copied ? t('uiVintage.blog.share.copied') : t('uiVintage.blog.share.copy')" :title="t('uiVintage.blog.share.copy')" :class="[buttonClasses, 'hover:border-primary hover:bg-primary hover:text-primary-foreground!', copied && 'border-primary text-primary']" @click="copyLink">
84
+ <Transition mode="out-in" enter-active-class="transition-[opacity,scale] duration-300 ease-bounce" enter-from-class="opacity-0 scale-50" leave-active-class="transition-opacity duration-100" leave-to-class="opacity-0">
85
+ <HugeiconsIcon :key="String(copied)" :icon="copied ? Tick02Icon : Link01Icon" class="size-4" />
86
+ </Transition>
87
+ </button>
88
+ </div>
76
89
  </div>
77
90
 
78
91
  <!-- Mobile view (floating bar at bottom) -->
79
- <div class="fixed bottom-4 left-1/2 z-20 -translate-x-1/2 xl:hidden">
80
- <Card class="p-3! w-fit">
81
- <CardContent class="flex-row! p-0! items-center justify-center gap-3">
82
- <!-- Social share links (mobile) -->
83
- <template v-for="platform in socialPlatforms" :key="platform.name">
84
- <NuxtLink :to="platform.url"
85
- target="_blank"
86
- rel="noopener noreferrer"
87
- :aria-label="platform.label"
88
- :class="['w-10 h-10 rounded flex items-center justify-center text-white transition-all duration-200 hover:opacity-80 hover:scale-105', platform.color]">
89
- <HugeiconsIcon :icon="platform.icon" class="size-4" />
90
- </NuxtLink>
91
- </template>
92
- </CardContent>
93
- </Card>
92
+ <div class="fixed bottom-4 left-1/2 z-20 -translate-x-1/2 animate-[uv-fade-up_0.7s_var(--ease-out-expo)_0.8s_both] xl:hidden">
93
+ <div class="flex items-center gap-2 rounded border border-border bg-card p-2 shadow-elevated-sm">
94
+ <!-- Social share links (mobile) -->
95
+ <a v-for="platform in socialPlatforms" :key="platform.name" :href="platform.url" target="_blank" rel="noopener noreferrer" :aria-label="platform.label" :class="[buttonClasses, platform.color]">
96
+ <HugeiconsIcon :icon="platform.icon" class="size-4" />
97
+ </a>
98
+
99
+ <!-- Copy link -->
100
+ <button type="button" :aria-label="copied ? t('uiVintage.blog.share.copied') : t('uiVintage.blog.share.copy')" :class="[buttonClasses, 'hover:border-primary hover:bg-primary hover:text-primary-foreground!', copied && 'border-primary text-primary']" @click="copyLink">
101
+ <HugeiconsIcon :icon="copied ? Tick02Icon : Link01Icon" class="size-4" />
102
+ </button>
103
+ </div>
94
104
  </div>
95
105
  </Teleport>
96
106
  </template>