Skip to content

Commit 069f594

Browse files
committed
Fix linter
1 parent 0cd074c commit 069f594

File tree

3 files changed

+29
-12
lines changed

3 files changed

+29
-12
lines changed

next-env.d.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3-
/// <reference types="next/navigation-types/compat/navigation" />
43

54
// NOTE: This file should not be edited
6-
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
5+
// see https://nextjs.org/docs/pages/api-reference/config/typescript for more information.

src/components/Layout/HomeContent.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -514,11 +514,13 @@ export function HomeContent() {
514514

515515
<div className="mt-20 px-5 lg:px-0 mb-6 max-w-4xl text-center text-opacity-80">
516516
<div className="uwu-visible flex justify-center">
517-
<img
517+
<Image
518518
alt="logo by @sawaratsuki1004"
519519
title="logo by @sawaratsuki1004"
520520
className="uwu-visible mb-10 lg:mb-8 h-24 lg:h-32"
521521
src="/images/uwu.png"
522+
width={100}
523+
height={100}
522524
/>
523525
</div>
524526
<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" />
@@ -805,10 +807,12 @@ const CommunityImages = memo(function CommunityImages({isLazy}) {
805807
? 'rotate-2 group-hover:rotate-[-1deg] group-hover:scale-110 group-hover:shadow-lg lg:group-hover:shadow-2xl'
806808
: 'group-hover:rotate-1 group-hover:scale-110 group-hover:shadow-lg lg:group-hover:shadow-2xl rotate-[-2deg]'
807809
)}>
808-
<img
810+
<Image
809811
loading={isLazy ? 'lazy' : 'eager'}
810812
src={src}
811813
alt={alt}
814+
width={100}
815+
height={100}
812816
className="aspect-[4/3] h-full w-full flex object-cover rounded-2xl bg-gray-10 dark:bg-gray-80"
813817
/>
814818
</div>
@@ -1565,7 +1569,7 @@ function Cover({background, children}) {
15651569
<div className="absolute inset-0 px-4 py-2 flex items-end bg-gradient-to-t from-black/40 via-black/0">
15661570
{children}
15671571
</div>
1568-
<img
1572+
<Image
15691573
src={background}
15701574
width={500}
15711575
height={263}
@@ -1642,11 +1646,13 @@ function Thumbnail({video}) {
16421646
<>
16431647
<div className="transition-opacity mt-2.5 -space-x-2 flex flex-row w-full justify-center">
16441648
{image.speakers.map((src, i) => (
1645-
<img
1649+
<Image
16461650
key={i}
16471651
className="h-8 w-8 border-2 shadow-md border-gray-70 object-cover rounded-full"
16481652
src={src}
16491653
alt=""
1654+
width={100}
1655+
height={100}
16501656
/>
16511657
))}
16521658
</div>

src/components/MDX/MDXComponents.tsx

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {Children, useContext, useMemo} from 'react';
66
import * as React from 'react';
77
import cn from 'classnames';
88
import type {HTMLAttributes} from 'react';
9+
import Image from 'next/image';
910

1011
import CodeBlock from './CodeBlock';
1112
import {CodeDiagram} from './CodeDiagram';
@@ -285,9 +286,11 @@ function Illustration({
285286
return (
286287
<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">
287288
<figure className="my-8 flex justify-center">
288-
<img
289+
<Image
289290
src={src}
290291
alt={alt}
292+
width={700}
293+
height={300}
291294
style={{maxHeight: 300}}
292295
className="rounded-lg"
293296
/>
@@ -321,11 +324,12 @@ function IllustrationBlock({
321324
const images = imageInfos.map((info, index) => (
322325
<figure key={index}>
323326
<div className="bg-white rounded-lg p-4 flex-1 flex xl:p-6 justify-center items-center my-4">
324-
<img
327+
<Image
325328
className="text-primary"
326329
src={info.src}
327330
alt={info.alt}
328-
height={info.height}
331+
width={700}
332+
height={info.height || 300}
329333
/>
330334
</div>
331335
{info.caption ? (
@@ -455,9 +459,17 @@ function YouTubeIframe(props: any) {
455459
);
456460
}
457461

458-
function Image(props: any) {
462+
function CustomImage(props: any) {
459463
const {alt, ...rest} = props;
460-
return <img alt={alt} className="max-w-[calc(min(700px,100%))]" {...rest} />;
464+
return (
465+
<Image
466+
alt={alt}
467+
className="max-w-[calc(min(700px,100%))]"
468+
width={700}
469+
height={400}
470+
{...rest}
471+
/>
472+
);
461473
}
462474

463475
export const MDXComponents = {
@@ -474,7 +486,7 @@ export const MDXComponents = {
474486
h5: H5,
475487
hr: Divider,
476488
a: Link,
477-
img: Image,
489+
img: CustomImage,
478490
BlogCard,
479491
code: InlineCode,
480492
pre: CodeBlock,

0 commit comments

Comments
 (0)