Add draft logo in posts

This commit is contained in:
Florian RICHER 2023-12-09 22:16:05 +01:00
parent f7339b36e4
commit a5633fdfcd
4 changed files with 198 additions and 111 deletions

View file

@ -1,4 +1,5 @@
use leptos::*;
use leptos_icons::*;
use leptos_router::*;
use crate::app::{
models::Post,
@ -39,6 +40,18 @@ pub fn PostList() -> impl IntoView {
<a href=format!("posts/{}", post.slug.clone())>
<img src={post.metadata.image_path.clone()} alt=format!("Image {}", post.metadata.title)/>
{
if post.metadata.draft {
Some(view!{
<div class="warning">
<Icon icon=Icon::from(IoIcon::IoConstruct)/>
</div>
})
} else {
None
}
}
<div>
<h2>{post.metadata.title.clone()}</h2>
<p>{post.metadata.description.clone()}</p>