feat(web): activity indicator while loading

This commit is contained in:
Paul Armstrong
2021-01-30 08:52:37 -08:00
committed by Blake Blackshear
parent cc7929932b
commit 45526a7652
8 changed files with 65 additions and 19 deletions

View File

@@ -1,4 +1,5 @@
import { h } from 'preact';
import ActivityIndicator from './ActivityIndicator';
import { useApiHost, useConfig } from '../api';
import { useCallback, useEffect, useContext, useMemo, useRef, useState } from 'preact/hooks';
@@ -54,7 +55,11 @@ export default function CameraImage({ camera, onload, searchParams = '' }) {
return (
<div ref={containerRef}>
{loadedSrc ? <img width={scaledHeight * aspectRatio} height={scaledHeight} src={loadedSrc} alt={name} /> : null}
{loadedSrc ? (
<img width={scaledHeight * aspectRatio} height={scaledHeight} src={loadedSrc} alt={name} />
) : (
<ActivityIndicator />
)}
</div>
);
}