Show which slide show hours is fetched

This commit is contained in:
Guntis Smaukstelis
2025-02-23 20:21:11 +02:00
parent 6c9f544342
commit b6cc4a4b24
7 changed files with 65 additions and 25 deletions
+5 -3
View File
@@ -4,21 +4,23 @@ import styles from './harmonie.module.css'
export const SlideShow: Component<{
getCanvas: Accessor<HTMLCanvasElement | undefined>,
getImgList: Accessor<[string, ImageBitmap][]>,
getImgList: Accessor<[string, ImageBitmap | undefined][]>,
}> = ({
getCanvas,
getImgList
}) => {
function draw(img: ImageBitmap) {
function draw(img: ImageBitmap | undefined) {
const canvas = getCanvas()!
const ctx = canvas.getContext('2d')!
ctx.clearRect(0, 0, canvas.width, canvas.height)
if (!img) return;
ctx.drawImage(img, 0, 0)
}
return <ul class={styles.slideShow}>
{ getImgList().map(([forecastDate, img]) =>
<li onClick={() => draw(img)}>
<li class={img ? styles.withImg : ''} onClick={() => draw(img)}>
{ format(forecastDate) }
</li>)}
</ul>