2020-12-08 21:59:55 +00:00
|
|
|
@use crate::{pict::Extension, Entry, State};
|
2023-11-13 21:38:00 +00:00
|
|
|
@use uuid::Uuid;
|
2020-12-08 21:59:55 +00:00
|
|
|
|
2023-11-13 21:38:00 +00:00
|
|
|
@(id: Uuid, entry: &Entry, state: &State)
|
2020-12-08 21:59:55 +00:00
|
|
|
|
2022-05-27 23:27:44 +00:00
|
|
|
@if let Some(filename) = entry.filename() {
|
2020-12-08 21:59:55 +00:00
|
|
|
<div class="image-box">
|
2023-11-13 21:38:00 +00:00
|
|
|
<a href="#@id">
|
|
|
|
<picture>
|
|
|
|
<source type="image/webp" srcset="@state.srcset(filename, Extension::Webp)" />
|
|
|
|
<source type="image/avif" srcset="@state.srcset(filename, Extension::Avif)" />
|
|
|
|
<source type="image/jpeg" srcset="@state.srcset(filename, Extension::Jpg)" />
|
|
|
|
<img
|
|
|
|
loading="lazy"
|
|
|
|
src="@state.image_path(filename)"
|
|
|
|
@if let Some(title)=entry.title.as_ref() { title="@title" }
|
|
|
|
@if let Some(description)=entry.description.as_ref() { alt="@description" }
|
|
|
|
@if let Some(dimensions) = entry.dimensions() { width="@dimensions.width" height="@dimensions.height" }
|
|
|
|
/>
|
|
|
|
</picture>
|
|
|
|
</a>
|
2020-12-08 21:59:55 +00:00
|
|
|
</div>
|
2022-05-27 23:27:44 +00:00
|
|
|
} else {
|
|
|
|
<span>Pending</span>
|
|
|
|
}
|