mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 00:36:31 +02:00
perf(images): add sizes prop to improve Next.js image loading
This commit is contained in:
parent
fb20b0444f
commit
bb84bb25a3
3 changed files with 4 additions and 1 deletions
|
|
@ -408,6 +408,7 @@ const AudioCommentIllustration = () => (
|
||||||
src="/homepage/comments-audio.webp"
|
src="/homepage/comments-audio.webp"
|
||||||
alt="Audio Comment Illustration"
|
alt="Audio Comment Illustration"
|
||||||
fill
|
fill
|
||||||
|
sizes="(max-width: 768px) 100vw, (max-width: 1024px) 50vw, 33vw"
|
||||||
className="object-cover"
|
className="object-cover"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -307,6 +307,7 @@ export function Image({
|
||||||
src={src}
|
src={src}
|
||||||
alt={alt}
|
alt={alt}
|
||||||
fill
|
fill
|
||||||
|
sizes="(max-width: 512px) 100vw, 512px"
|
||||||
className={cn(
|
className={cn(
|
||||||
"transition-transform duration-300",
|
"transition-transform duration-300",
|
||||||
fit === "cover" ? "object-cover" : "object-contain",
|
fit === "cover" ? "object-cover" : "object-contain",
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,9 @@ export function getMDXComponents(components?: MDXComponents): MDXComponents {
|
||||||
img: ({ className, alt, ...props }: React.ComponentProps<"img">) => (
|
img: ({ className, alt, ...props }: React.ComponentProps<"img">) => (
|
||||||
<Image
|
<Image
|
||||||
{...(props as ImageProps)}
|
{...(props as ImageProps)}
|
||||||
className={cn("rounded-md border", className)}
|
|
||||||
alt={alt ?? ""}
|
alt={alt ?? ""}
|
||||||
|
sizes="(max-width: 768px) 100vw, 896px"
|
||||||
|
className={cn("rounded-md border", className)}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
Video: ({ className, ...props }: React.ComponentProps<"video">) => (
|
Video: ({ className, ...props }: React.ComponentProps<"video">) => (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue