Skip to content

Commit cb90cc8

Browse files
committed
Rename useLoaded to useIsLoaded
1 parent 74be96c commit cb90cc8

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/components/EmbeddedVideo.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import classNames from 'classnames';
44
import React, { useRef } from 'react';
55
import LoadingSpinner from './LoadingSpinner';
6-
import { useLoading } from '../hooks';
6+
import { useIsLoading } from '../hooks';
77

88
const sizes = Object.freeze({
99
xs: {
@@ -54,7 +54,7 @@ export default function EmbeddedVideo({
5454
width,
5555
}: EmbeddedVideoProps) {
5656
const ref = useRef<HTMLIFrameElement>(null);
57-
const loading = useLoading(ref);
57+
const loading = useIsLoading(ref);
5858
const offline = typeof navigator !== 'undefined' && !navigator.onLine;
5959
const _width = width || (size && sizes[size].width);
6060
const _height = height || (size && sizes[size].height);

src/components/ProgressiveImage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import classNames from 'classnames';
44
import React, { useRef } from 'react';
55
import LoadingSpinner from './LoadingSpinner';
6-
import { useLoaded } from '../hooks';
6+
import { useIsLoaded } from '../hooks';
77

88
export type ProgressiveImageProps = {
99
alt?: string;
@@ -42,7 +42,7 @@ export default function ProgressiveImage({
4242
...rest
4343
}: ProgressiveImageProps) {
4444
const imageRef = useRef<HTMLImageElement>(null);
45-
const loaded = useLoaded(imageRef, undefined, onLoad);
45+
const loaded = useIsLoaded(imageRef, undefined, onLoad);
4646
return (
4747
<picture
4848
className={classNames(

src/hooks/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
export * from './useBodyOverflow';
22
export * from './useBreakpoint';
33
export * from './useElementSize';
4+
export * from './useIsLoaded';
45
export * from './useIsMounted';
56
export * from './useIsomorphicLayoutEffect';
67
export * from './useKeyboardEvent';
7-
export * from './useLoaded';
88
export * from './useLocalStorage';
99
export * from './useMediaQuery';
1010
export * from './usePagination';

src/hooks/useLoaded.ts renamed to src/hooks/useIsLoaded.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { useEffect, useState } from 'react';
44
import { bindEvent, unbindEvent } from '../utils';
55

6-
export function useLoaded(
6+
export function useIsLoaded(
77
ref: React.RefObject<HTMLElement>,
88
key?: string,
99
onLoad?: () => void,
@@ -52,9 +52,9 @@ export function useLoaded(
5252
return loaded;
5353
}
5454

55-
export function useLoading(
55+
export function useIsLoading(
5656
ref: React.RefObject<HTMLElement>,
5757
key?: string,
5858
): boolean {
59-
return !useLoaded(ref, key);
59+
return !useIsLoaded(ref, key);
6060
}

0 commit comments

Comments
 (0)