import { Component, createSignal, Show } from 'solid-js'; import SafeLink from '@/components/utils/SafeLink'; import { fixUrl } from '@/utils/imageUrl'; type ImageDisplayProps = { url: string; initialHidden: boolean; }; const ImageDisplay: Component = (props) => { let imageRef: HTMLImageElement | undefined; let canvasRef: HTMLCanvasElement | undefined; const [hidden, setHidden] = createSignal(props.initialHidden); const [playing, setPlaying] = createSignal(true); // const isGIF = () => props.url.match(/\.gif/i); const play = () => { setPlaying(true); }; /* const stop = () => { if (canvasRef == null || imageRef == null) return; canvasRef.width = imageRef.width; canvasRef.height = imageRef.height; canvasRef .getContext('2d') ?.drawImage( imageRef, 0, 0, imageRef.naturalWidth, imageRef.naturalHeight, 0, 0, imageRef.width, imageRef.height, ); setPlaying(false); }; */ return ( setHidden(false)} > 画像を展開する } > {props.url} { ev.preventDefault(); play(); }} /> {/* */} ); }; export default ImageDisplay;