memorium/components/Image.tsx

41 lines
803 B
TypeScript
Raw Normal View History

2023-08-09 13:32:28 +02:00
import { asset } from "$fresh/runtime.ts";
2023-08-08 21:55:10 +02:00
import * as CSS from "https://esm.sh/csstype@3.1.2";
2023-08-08 21:50:23 +02:00
2023-08-08 21:55:10 +02:00
const Image = (
props: {
class: string;
src: string;
alt?: string;
thumbnail?: string;
2023-08-08 21:55:10 +02:00
width?: number | string;
height?: number | string;
style?: CSS.HtmlAttributes;
},
) => {
2023-08-08 21:50:23 +02:00
return (
<span
style={{
position: "absolute",
width: "100%",
height: "100%",
zIndex: -1,
}}
data-thumb={props.thumbnail}
>
<img
data-thumb={props.thumbnail}
data-thumb-img
loading="lazy"
alt={props.alt}
style={props.style}
src={asset(props.src)}
width={props.width}
height={props.height}
class={props.class}
/>
</span>
2023-08-08 21:50:23 +02:00
);
2023-08-08 21:55:10 +02:00
};
export default Image;