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

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<div class="flex justify-center -space-x-2 overflow-hidden py-1">
22
@foreach ($users as $user)
33
<img
4+
loading="lazy"
45
class="inline-block size-8 rounded-full ring-2 ring-white"
56
src="{{ $user->profile_photo_url }}"
67
alt="{{ $user->username }} avatar"

resources/views/components/sponsors.blade.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
<div class="mt-5 space-y-5">
66
<a href="https://laravelshopper.dev" class="flex items-center justify-end">
77
<img
8+
loading="lazy"
89
class="logo-white h-10"
910
src="{{ asset('/images/sponsors/shopper-logo.svg') }}"
1011
alt="Laravel Shopper"
1112
/>
1213
<img
14+
loading="lazy"
1315
class="logo-dark h-10"
1416
src="{{ asset('/images/sponsors/shopper-logo-light.svg') }}"
1517
alt="Laravel Shopper"

resources/views/components/user/avatar.blade.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
@if ($user->is_sponsor)
88
<span @class(['relative inline-block', $container])>
99
<img
10+
loading="lazy"
1011
{{ $attributes->twMerge(['class' => 'object-cover bg-gray-100 dark:bg-gray-900 rounded-full ring-2 !ring-flag-yellow']) }}
1112
src="{{ $user->profile_photo_url }}"
1213
alt="{{ $user->username() }}"
@@ -28,6 +29,7 @@ class="size-full text-yellow-500"
2829
</span>
2930
@else
3031
<img
32+
loading="lazy"
3133
{{ $attributes->merge(['class' => 'object-cover rounded-full bg-gray-100 dark:bg-gray-900']) }}
3234
src="{{ $user->profile_photo_url }}"
3335
alt="{{ $user->username() }}"

resources/views/livewire/pages/about.blade.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ class="mt-2 block text-2xl font-extrabold tracking-tight sm:text-3xl xl:text-4xl
150150
<div class="mt-14 columns-2 gap-4 sm:columns-3 lg:mt-0">
151151
<div class="relative">
152152
<img
153+
loading="lazy"
153154
src="https://res.cloudinary.com/dlzdb3m6n/image/upload/v1703778123/IMG_1637_yjaqrk.jpg"
154155
alt=""
155156
class="aspect-[2/3] w-full rounded-xl bg-gray-900/5 object-cover shadow-lg"
@@ -160,6 +161,7 @@ class="pointer-events-none absolute inset-0 rounded-xl ring-1 ring-inset ring-gr
160161
</div>
161162
<div class="relative">
162163
<img
164+
loading="lazy"
163165
src="https://res.cloudinary.com/dlzdb3m6n/image/upload/v1703778121/IMG_1505_j06cwz.jpg"
164166
alt=""
165167
class="aspect-[2/3] w-full rounded-xl bg-gray-900/5 object-cover shadow-lg lg:aspect-[1/2]"
@@ -170,6 +172,7 @@ class="pointer-events-none absolute inset-0 rounded-xl ring-1 ring-inset ring-gr
170172
</div>
171173
<div class="relative">
172174
<img
175+
loading="lazy"
173176
src="https://res.cloudinary.com/dlzdb3m6n/image/upload/v1703778122/IMG_1609_otohw5.jpg"
174177
alt=""
175178
class="aspect-[2/3] w-full rounded-xl bg-gray-900/5 object-cover shadow-lg lg:aspect-[2/5]"
@@ -180,6 +183,7 @@ class="pointer-events-none absolute inset-0 rounded-xl ring-1 ring-inset ring-gr
180183
</div>
181184
<div class="relative">
182185
<img
186+
loading="lazy"
183187
src="https://res.cloudinary.com/dlzdb3m6n/image/upload/v1703778121/IMG_1605_zdgdpv.jpg"
184188
alt=""
185189
class="aspect-[2/3] w-full rounded-xl bg-gray-900/5 object-cover shadow-lg lg:aspect-[4/5]"
@@ -190,6 +194,7 @@ class="pointer-events-none absolute inset-0 rounded-xl ring-1 ring-inset ring-gr
190194
</div>
191195
<div class="relative">
192196
<img
197+
loading="lazy"
193198
src="https://res.cloudinary.com/dlzdb3m6n/image/upload/v1703778122/IMG_1567_hfy747.jpg"
194199
alt=""
195200
class="aspect-[2/3] w-full rounded-xl bg-gray-900/5 object-cover shadow-lg"
@@ -200,6 +205,7 @@ class="pointer-events-none absolute inset-0 rounded-xl ring-1 ring-inset ring-gr
200205
</div>
201206
<div class="relative">
202207
<img
208+
loading="lazy"
203209
src="https://res.cloudinary.com/dlzdb3m6n/image/upload/v1703782759/phnnfnzxt8khtrth4qem.jpg"
204210
alt=""
205211
class="aspect-[2/3] w-full rounded-xl bg-gray-900/5 object-cover shadow-lg lg:aspect-[3/7]"
@@ -232,7 +238,7 @@ class="space-y-12 sm:grid sm:grid-cols-2 sm:gap-x-6 sm:gap-y-12 sm:space-y-0 lg:
232238
@foreach($profiles as $profile)
233239
<li>
234240
<div class="space-y-4">
235-
<img class="h-16 w-16 rounded-full lg:h-20 lg:w-20" src="{{ $profile['avatar'] }}" alt="{{ $profile['name'] }}" />
241+
<img loading="lazy" class="h-16 w-16 rounded-full lg:h-20 lg:w-20" src="{{ $profile['avatar'] }}" alt="{{ $profile['name'] }}" />
236242
<div class="space-y-1 text-lg font-medium leading-6 text-gray-900">
237243
<h3>{{ $profile['name'] }}</h3>
238244
<p class="font-sans text-base text-green-600">{{ $profile['title'] }}</p>

resources/views/livewire/pages/articles/single-post.blade.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ class="size-6 ring-1 ring-offset-2 ring-gray-200 ring-offset-gray-50 dark:ring-w
9797
<div class="mt-4 lg:mt-0 lg:col-span-2">
9898
<div class="relative aspect-[16/9] lg:aspect-[2/1] rounded-xl shadow-lg overflow-hidden">
9999
<img
100+
loading="lazy"
100101
class="object-cover size-full"
101102
src="{{ $media }}"
102103
alt="{{ $article->title }}"

resources/views/livewire/pages/home.blade.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ class="font-medium text-flag-green hover:text-green-500 hover:underline"
174174
<div class="h-full w-full xl:grid xl:grid-cols-2">
175175
<div class="h-full xl:relative xl:col-start-2">
176176
<img
177+
loading="lazy"
177178
class="h-full w-full object-cover opacity-25 xl:absolute xl:inset-0"
178179
src="{{ asset('/images/developer.jpg') }}"
179180
alt="Developer working on laptop"

resources/views/livewire/pages/sponsoring.blade.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,13 @@
5959
<div class="mt-4 flex flex-wrap items-center gap-6">
6060
<a href="https://laravelshopper.dev" target="_blank" class="flex items-center">
6161
<img
62+
loading="lazy"
6263
class="h-10 dark:hidden"
6364
src="{{ asset('/images/sponsors/shopper-logo.svg') }}"
6465
alt="Laravel Shopper"
6566
/>
6667
<img
68+
loading="lazy"
6769
class="hidden h-10 dark:block"
6870
src="{{ asset('/images/sponsors/shopper-logo-light.svg') }}"
6971
alt="Laravel Shopper"

resources/views/livewire/reactions.blade.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class="size-5 text-gray-400 dark:text-gray-500 group-hover:text-gray-600 dark:gr
4444
<div class="flex items-center justify-center space-x-2">
4545
@foreach ($model->getReactionsSummary() as $reaction)
4646
<img
47+
loading="lazy"
4748
class="size-4"
4849
src="{{ asset("/images/reactions/{$reaction->name}.svg") }}"
4950
alt="{{ $reaction->name }} emoji"
@@ -73,28 +74,28 @@ class="absolute z-30 left-6 w-auto origin-top-left"
7374
<div class="rounded-full bg-white ring-1 ring-inset ring-gray-100 px-3 py-1.5 dark:bg-gray-800 dark:ring-white/10">
7475
<div class="reactions flex items-center gap-4">
7576
<button type="button" class="{{ $buttonClasses }}" wire:click="userReacted('clap')">
76-
<img src="{{ asset('/images/reactions/clap.svg') }}" class="size-5" alt="clap emoji" />
77+
<img loading="lazy" src="{{ asset('/images/reactions/clap.svg') }}" class="size-5" alt="clap emoji" />
7778
</button>
7879
<button type="button" class="{{ $buttonClasses }}" wire:click="userReacted('fire')">
79-
<img src="{{ asset('/images/reactions/fire.svg') }}" class="size-5" alt="fire emoji" />
80+
<img loading="lazy" src="{{ asset('/images/reactions/fire.svg') }}" class="size-5" alt="fire emoji" />
8081
</button>
8182
<button type="button" class="{{ $buttonClasses }}" wire:click="userReacted('handshake')">
82-
<img src="{{ asset('/images/reactions/handshake.svg') }}" class="size-5" alt="handshake emoji" />
83+
<img loading="lazy" src="{{ asset('/images/reactions/handshake.svg') }}" class="size-5" alt="handshake emoji" />
8384
</button>
8485
<button type="button" class="{{ $buttonClasses }}" wire:click="userReacted('joy')">
85-
<img src="{{ asset('/images/reactions/joy.svg') }}" class="size-5" alt="joy emoji" />
86+
<img loading="lazy" src="{{ asset('/images/reactions/joy.svg') }}" class="size-5" alt="joy emoji" />
8687
</button>
8788
<button type="button" class="{{ $buttonClasses }}" wire:click="userReacted('love')">
88-
<img src="{{ asset('/images/reactions/love.svg') }}" class="size-5" alt="love emoji" />
89+
<img loading="lazy" src="{{ asset('/images/reactions/love.svg') }}" class="size-5" alt="love emoji" />
8990
</button>
9091
<button type="button" class="{{ $buttonClasses }}" wire:click="userReacted('money')">
91-
<img src="{{ asset('/images/reactions/money.svg') }}" class="size-5" alt="money emoji" />
92+
<img loading="lazy" src="{{ asset('/images/reactions/money.svg') }}" class="size-5" alt="money emoji" />
9293
</button>
9394
<button type="button" class="{{ $buttonClasses }}" wire:click="userReacted('party')">
94-
<img src="{{ asset('/images/reactions/party.svg') }}" class="size-5" alt="party emoji" />
95+
<img loading="lazy" src="{{ asset('/images/reactions/party.svg') }}" class="size-5" alt="party emoji" />
9596
</button>
9697
<button type="button" class="{{ $buttonClasses }}" wire:click="userReacted('pray')">
97-
<img src="{{ asset('/images/reactions/pray.svg') }}" class="size-5" alt="pray" />
98+
<img loading="lazy" src="{{ asset('/images/reactions/pray.svg') }}" class="size-5" alt="pray" />
9899
</button>
99100
</div>
100101
</div>

resources/views/vendor/mail/html/header.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<td class="header">
33
<a href="{{ $url }}" style="display: inline-block">
44
@if (trim($slot) === 'Laravel')
5-
<img src="https://laravel.com/img/notification-logo.png" class="logo" alt="Laravel Cameroun logo" />
5+
<img loading="lazy" src="https://laravel.com/img/notification-logo.png" class="logo" alt="Laravel Cameroun logo" />
66
@else
77
{{ $slot }}
88
@endif

0 commit comments

Comments
 (0)