File tree Expand file tree Collapse file tree 2 files changed +27
-11
lines changed
Expand file tree Collapse file tree 2 files changed +27
-11
lines changed Original file line number Diff line number Diff line change @@ -509,11 +509,14 @@ export function HomeContent() {
509509
510510 < div className = "mt-20 px-5 lg:px-0 mb-6 max-w-4xl text-center text-opacity-80" >
511511 < div className = "uwu-visible flex justify-center" >
512- < img
512+ < Image
513513 alt = "logo by @sawaratsuki1004"
514514 title = "logo by @sawaratsuki1004"
515515 className = "uwu-visible mb-10 lg:mb-8 h-24 lg:h-32"
516516 src = "/images/uwu.png"
517+ width = { 128 }
518+ height = { 128 }
519+ priority
517520 />
518521 </ div >
519522 < Logo className = "uwu-hidden text-brand dark:text-brand-dark w-24 lg:w-28 mb-10 lg:mb-8 mt-12 h-auto mx-auto self-start" />
@@ -802,11 +805,13 @@ const CommunityImages = memo(function CommunityImages({isLazy}) {
802805 className = { cn (
803806 'overflow-clip relative before:absolute before:inset-0 before:pointer-events-none before:-translate-x-full group-hover:before:animate-[shimmer_1s_forwards] before:bg-gradient-to-r before:from-transparent before:via-white/10 before:to-transparent transition-transform ease-in-out duration-300'
804807 ) } >
805- < img
806- loading = { isLazy ? 'lazy' : 'eager' }
808+ < Image
807809 src = { src }
808810 alt = { alt }
809811 className = "aspect-[4/3] h-full w-full flex object-cover rounded-2xl bg-gray-10 dark:bg-gray-80"
812+ width = { 400 }
813+ height = { 300 }
814+ loading = { isLazy ? 'lazy' : 'eager' }
810815 />
811816 </ div >
812817 </ div >
@@ -1564,7 +1569,7 @@ function Cover({background, children}) {
15641569 < div className = "absolute inset-0 px-4 py-2 flex items-end bg-gradient-to-t from-black/40 via-black/0" >
15651570 { children }
15661571 </ div >
1567- < img
1572+ < Image
15681573 src = { background }
15691574 width = { 500 }
15701575 height = { 263 }
@@ -1641,11 +1646,13 @@ function Thumbnail({video}) {
16411646 < >
16421647 < div className = "transition-opacity mt-2.5 -space-x-2 flex flex-row w-full justify-center" >
16431648 { image . speakers . map ( ( src , i ) => (
1644- < img
1649+ < Image
16451650 key = { i }
16461651 className = "h-8 w-8 border-2 shadow-md border-gray-70 object-cover rounded-full"
16471652 src = { src }
16481653 alt = ""
1654+ width = { 32 }
1655+ height = { 32 }
16491656 />
16501657 ) ) }
16511658 </ div >
Original file line number Diff line number Diff line change 1+ import Image from 'next/image' ;
12/**
23 * Copyright (c) Meta Platforms, Inc. and affiliates.
34 *
@@ -315,7 +316,7 @@ function Illustration({
315316 return (
316317 < div className = "relative group before:absolute before:-inset-y-16 before:inset-x-0 my-16 mx-0 2xl:mx-auto max-w-4xl 2xl:max-w-6xl" >
317318 < figure className = "my-8 flex justify-center" >
318- < img
319+ < Image
319320 src = { src }
320321 alt = { alt }
321322 style = { { maxHeight : 300 } }
@@ -351,7 +352,7 @@ function IllustrationBlock({
351352 const images = imageInfos . map ( ( info , index ) => (
352353 < figure key = { index } >
353354 < div className = "bg-white rounded-lg p-4 flex-1 flex xl:p-6 justify-center items-center my-4" >
354- < img
355+ < Image
355356 className = "text-primary"
356357 src = { info . src }
357358 alt = { info . alt }
@@ -485,9 +486,17 @@ function YouTubeIframe(props: any) {
485486 ) ;
486487}
487488
488- function Image ( props : any ) {
489- const { alt, ...rest } = props ;
490- return < img alt = { alt } className = "max-w-[calc(min(700px,100%))]" { ...rest } /> ;
489+ function ImageComponent ( props : any ) {
490+ const { alt, width = 700 , height = 400 , ...rest } = props ;
491+ return (
492+ < Image
493+ alt = { alt }
494+ width = { width }
495+ height = { height }
496+ className = "max-w-[calc(min(700px,100%))]"
497+ { ...rest }
498+ />
499+ ) ;
491500}
492501
493502export const MDXComponents = {
@@ -504,7 +513,7 @@ export const MDXComponents = {
504513 h5 : H5 ,
505514 hr : Divider ,
506515 a : Link ,
507- img : Image ,
516+ img : ImageComponent ,
508517 BlogCard,
509518 code : InlineCode ,
510519 pre : CodeBlock ,
You can’t perform that action at this time.
0 commit comments