Просмотр исходного кода

RHL-046 feat(overview): enhance OverviewCard with customizable image loading attributes

Code_Uwe 1 месяц назад
Родитель
Сommit
f351963803
2 измененных файлов с 10 добавлено и 2 удалено
  1. 6 1
      components/overview/OverviewCard.jsx
  2. 4 1
      components/overview/OverviewHomePage.jsx

+ 6 - 1
components/overview/OverviewCard.jsx

@@ -17,6 +17,9 @@ export default function OverviewCard({
 	href = null,
 	href = null,
 	disabledHint = null,
 	disabledHint = null,
 	containerClassName = "",
 	containerClassName = "",
+	imageLoading = "lazy",
+	imageFetchPriority = "auto",
+	imageDecoding = "async",
 }) {
 }) {
 	const isDisabled = !href;
 	const isDisabled = !href;
 
 
@@ -36,7 +39,9 @@ export default function OverviewCard({
 					src={imageSrc}
 					src={imageSrc}
 					alt={`${title} Karte`}
 					alt={`${title} Karte`}
 					className="h-full w-full object-cover"
 					className="h-full w-full object-cover"
-					loading="lazy"
+					loading={imageLoading}
+					fetchPriority={imageFetchPriority}
+					decoding={imageDecoding}
 				/>
 				/>
 			</div>
 			</div>
 
 

+ 4 - 1
components/overview/OverviewHomePage.jsx

@@ -41,7 +41,7 @@ export default function OverviewHomePage() {
 
 
 				<div className="flex flex-1 items-center justify-center pt-20 pb-10">
 				<div className="flex flex-1 items-center justify-center pt-20 pb-10">
 					<div className={cardsRowClassName}>
 					<div className={cardsRowClassName}>
-						{cards.map((card) => (
+						{cards.map((card, index) => (
 							<OverviewCard
 							<OverviewCard
 								key={card.key}
 								key={card.key}
 								title={card.title}
 								title={card.title}
@@ -50,6 +50,9 @@ export default function OverviewHomePage() {
 								href={card.href}
 								href={card.href}
 								disabledHint={card.disabledHint}
 								disabledHint={card.disabledHint}
 								containerClassName={cardItemClassName}
 								containerClassName={cardItemClassName}
+								imageLoading="eager"
+								imageFetchPriority={index < 2 ? "high" : "auto"}
+								imageDecoding="async"
 							/>
 							/>
 						))}
 						))}
 					</div>
 					</div>