Skip to content

Commit 441ee73

Browse files
feat:[lar-156] Add lazy loading in img (#286)
2 parents 8086d59 + baa04d2 commit 441ee73

19 files changed

+39
-14
lines changed

resources/views/components/ads.blade.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<div id="laravelcm-ads">
44
<a href="{{ $ads['url'] }}" target="_blank" class="block aspect-[2/1] rounded-lg overflow-hidden ring-1 ring-gray-200/50 shadow dark:ring-white/20">
55
<img
6+
loading="lazy"
67
class="size-full object-cover"
78
src="{{ asset("/images/ads/{$ads['image']}.png") }}"
89
alt="{{ $ads['alt'] }}"

resources/views/components/articles/card-author.blade.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<article class="relative" wire:key="{{ $article->slug }}">
1212
<div class="relative w-full">
1313
<img
14+
loading="lazy"
1415
src="{{ $media }}"
1516
alt="{{ $article->title }}"
1617
class="aspect-[16/9] w-full rounded-2xl bg-gray-100 object-cover sm:aspect-[2/1] dark:bg-gray-800"

resources/views/components/articles/card.blade.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
@if(! $isSummary)
1717
<div class="aspect-[2/1] w-full rounded-lg bg-gray-100 overflow-hidden shadow-sm transition group-hover:opacity-80">
1818
<img
19+
loading="lazy"
1920
class="rounded-lg object-cover shadow-sm group-hover:opacity-75"
2021
src="{{ $media }}"
2122
alt="{{ $article->title }}"

resources/views/components/articles/overview.blade.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class="space-y-4 lg:grid lg:grid-cols-3 lg:items-start lg:gap-6 lg:space-y-0"
1515
<x-link :href="route('articles.show', $article)" class="group">
1616
<div class="aspect-h-2 aspect-w-3">
1717
<img
18+
loading="lazy"
1819
class="rounded-lg object-cover shadow-lg group-hover:opacity-75"
1920
src="{{ $media }}"
2021
alt="{{ $article->title }}"

resources/views/components/discussions/overview.blade.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class="text-gray-700 dark:text-gray-300 font-medium hover:underline"
5151
<div class="flex items-center justify-center gap-2">
5252
@foreach ($discussion->getReactionsSummary() as $reaction)
5353
<img
54+
loading="lazy"
5455
class="size-4"
5556
src="{{ asset("/images/reactions/{$reaction->name}.svg") }}"
5657
alt="{{ $reaction->name }} emoji"

resources/views/components/dropdown-profile.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ class="group flex items-center gap-2 py-1.5 text-sm font-medium text-gray-500 da
6060
role="menuitem"
6161
tabindex="-1"
6262
>
63-
<img class="size-5 object-cover" src="{{ asset('images/filament-icon.png') }}" alt="Filament icon" />
64-
Administration
63+
<img loading="lazy" class="size-5 object-cover" src="{{ asset('images/filament-icon.png') }}" alt="Filament icon" />
64+
{{ __('Administration') }}
6565
</x-link>
6666
</div>
6767
@endif

resources/views/components/feeds/comment.blade.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<div class="relative flex items-start space-x-3">
33
<div class="relative">
44
<img
5+
loading="lazy"
56
class="flex size-10 items-center justify-center rounded-full bg-white dark:bg-gray-800 ring-4 ring-white dark:ring-white/10"
67
src="{{ $user->profile_photo_url }}"
78
alt="Avatar de {{ $user->username }}"

resources/views/components/join-sponsors.blade.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@
1010
<div class="flex items-center justify-center px-2">
1111
<a href="https://laravelshopper.dev" target="_blank" class="flex items-center">
1212
<img
13+
loading="lazy"
1314
class="h-12 dark:hidden"
1415
src="{{ asset('/images/sponsors/shopper-logo.svg') }}"
1516
alt="Laravel Shopper"
1617
/>
1718
<img
19+
loading="lazy"
1820
class="hidden h-12 dark:block"
1921
src="{{ asset('/images/sponsors/shopper-logo-light.svg') }}"
2022
alt="Laravel Shopper"

resources/views/components/layouts/footer.blade.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
</a>
1212
<span class="ml-1.5">{{ __('global.by') }} Caneco</span>
1313
<img
14+
loading="lazy"
1415
class="ml-2 size-6 rounded-full"
1516
src="https://avatars.githubusercontent.com/u/502041"
1617
alt="Caneco avatar"

resources/views/components/layouts/header.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ class="group inline-flex items-center"
2020
@if(isHolidayWeek())
2121
<div class="relative">
2222
<div class="absolute z-0 lg:left-1/4">
23-
<img src="{{ asset('images/decoration.gif') }}" class="w-auto h-10" alt="Christmas decoration">
23+
<img loading="lazy" src="{{ asset('images/decoration.gif') }}" class="w-auto h-10" alt="Christmas decoration">
2424
</div>
2525
<div class="absolute z-0 lg:right-12">
26-
<img src="{{ asset('images/decoration.gif') }}" class="w-auto h-10" alt="Christmas decoration">
26+
<img loading="lazy" src="{{ asset('images/decoration.gif') }}" class="w-auto h-10" alt="Christmas decoration">
2727
</div>
2828
</div>
2929
@endif

0 commit comments

Comments
 (0)