Skip to content

Commit c077b18

Browse files
committed
review
1 parent 05fe406 commit c077b18

File tree

1 file changed

+2
-27
lines changed
  • packages/gitbook/src/components/utils

1 file changed

+2
-27
lines changed

packages/gitbook/src/components/utils/Image.tsx

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import type { ImageResizer } from '@/lib/images';
33
import ReactDOM from 'react-dom';
44

55
import { type ClassValue, tcls } from '@/lib/tailwind';
6-
7-
import { checkIsHttpURL } from '@/lib/urls';
86
import { ZoomImage } from './ZoomImage';
97
import type { PolymorphicComponentProp } from './types';
108

@@ -60,16 +58,6 @@ interface ImageCommonProps {
6058
*/
6159
zoom?: boolean;
6260

63-
/**
64-
* Priority of the image.
65-
* - `lazy` will load the image only when it's visible in the viewport.
66-
* - `eager` will load the image as soon as possible, even if it's not visible; but will not preload.
67-
* - `high` will preload.
68-
*
69-
* @default normal
70-
*/
71-
priority?: 'lazy' | 'normal' | 'high';
72-
7361
/**
7462
* Force preloading the image.
7563
* Even if the priority is set to `lazy`, the image will be preloaded.
@@ -198,11 +186,12 @@ async function ImagePictureSized(
198186
style: _style,
199187
alt,
200188
quality = 100,
201-
priority = 'normal',
202189
inline = false,
203190
zoom = false,
204191
resize = false,
205192
preload = false,
193+
loading,
194+
fetchPriority,
206195
inlineStyle,
207196
...rest
208197
} = props;
@@ -212,9 +201,6 @@ async function ImagePictureSized(
212201
}
213202

214203
const attrs = await getImageAttributes({ sizes, source, quality, resize });
215-
const canBeFetched = checkIsHttpURL(attrs.src);
216-
const fetchPriority = canBeFetched ? getFetchPriority(priority) : undefined;
217-
const loading = priority === 'lazy' ? 'lazy' : undefined;
218204
const aspectRatioStyle = source.aspectRatio ? { aspectRatio: source.aspectRatio } : {};
219205
const style = { ...aspectRatioStyle, ...inlineStyle };
220206

@@ -310,14 +296,3 @@ export async function getImageAttributes(params: {
310296
...source.size,
311297
};
312298
}
313-
314-
function getFetchPriority(priority: ImageCommonProps['priority']) {
315-
switch (priority) {
316-
case 'lazy':
317-
return 'low';
318-
case 'high':
319-
return 'high';
320-
default:
321-
return undefined;
322-
}
323-
}

0 commit comments

Comments
 (0)