Skip to content

Commit b0c2568

Browse files
♿️ Refactor early adopter card structure to use semantic HTML elements and improve accessibility
1 parent 7028fbf commit b0c2568

File tree

1 file changed

+23
-16
lines changed

1 file changed

+23
-16
lines changed

resources/views/components/wall-of-love/early-adopter-card.blade.php

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@
66
'featured' => false,
77
])
88

9-
<div
9+
<article
1010
class="group mt-3 inline-block break-inside-avoid overflow-hidden rounded-2xl text-center opacity-0 transition duration-300 ease-out will-change-transform hover:scale-102 xl:mt-5"
11+
itemscope
1112
>
12-
<div class="grid">
13+
<figure class="grid">
1314
{{-- Image --}}
1415
<img
1516
src="{{ $image }}"
16-
alt="{{ $name }}"
17+
alt="{{ $title ? $name . ', ' . $title : $name }}"
1718
loading="lazy"
18-
width="auto"
19-
height="auto"
19+
decoding="async"
20+
itemprop="image"
2021
@class([
2122
'self-center justify-self-center object-cover brightness-80 transition duration-300 [grid-area:1/-1] group-hover:brightness-100',
2223
'aspect-[1/1.3] xl:aspect-[1/1.5]' => $featured,
@@ -25,49 +26,55 @@ class="group mt-3 inline-block break-inside-avoid overflow-hidden rounded-2xl te
2526
/>
2627

2728
{{-- Name & Title --}}
28-
<div
29+
<figcaption
2930
@class([
30-
'relative z-0 w-full self-end justify-self-start bg-gradient-to-t px-4 pt-13 pb-4 text-white [grid-area:1/-1]',
31+
'relative z-0 w-full self-end justify-self-start truncate bg-gradient-to-t px-4 pt-13 pb-4 text-white [grid-area:1/-1]',
3132
'from-blue-500 to-transparent' => $featured,
3233
'from-black to-transparent' => ! $featured,
3334
])
3435
>
3536
<div
36-
class="transition duration-300 ease-out will-change-transform group-hover:-translate-y-0.5"
37+
class="capitalize transition duration-300 ease-out will-change-transform group-hover:-translate-y-0.5"
3738
>
3839
<h3
3940
@class([
40-
'truncate capitalize',
4141
'text-lg font-medium' => $featured,
4242
])
43+
itemprop="name"
4344
>
4445
{{ $name }}
4546
</h3>
46-
<h4
47+
<p
4748
@class([
48-
'truncate capitalize opacity-50',
49+
'opacity-50',
4950
'text-sm' => $featured,
5051
'text-xs' => ! $featured,
5152
])
53+
@if($title) itemprop="jobTitle" @endif
5254
>
5355
{{ $title }}
54-
</h4>
56+
</p>
5557
</div>
56-
</div>
58+
</figcaption>
5759

5860
{{-- External link --}}
5961
@if ($url)
6062
<a
6163
href="{{ $url }}"
6264
target="_blank"
6365
rel="nofollow noopener noreferrer"
66+
title="Visit {{ $name }}’s website"
67+
aria-label="Visit {{ $name }}’s website"
68+
itemprop="url"
6469
class="group/link mt-3 mr-3 flex items-center gap-2 self-start justify-self-end rounded-xl bg-white/70 px-3 py-1.5 opacity-0 backdrop-blur-sm transition duration-300 [grid-area:1/-1] group-hover:opacity-100 hover:bg-white/100 dark:bg-black/70 dark:hover:bg-black/100"
6570
>
66-
<div class="text-sm">Visit</div>
71+
<span class="text-sm">Visit</span>
6772
<x-icons.right-arrow
6873
class="h-3 -rotate-45 transition duration-300 will-change-transform group-hover/link:translate-x-px group-hover/link:-translate-y-px"
74+
aria-hidden="true"
75+
focusable="false"
6976
/>
7077
</a>
7178
@endif
72-
</div>
73-
</div>
79+
</figure>
80+
</article>

0 commit comments

Comments
 (0)