Update leptos_icons + Add chrono datetime for matter + Add reading time estimation

This commit is contained in:
Florian RICHER 2024-01-11 23:59:56 +01:00
parent 4ab4b95d8a
commit 8b7e528bc9
12 changed files with 362 additions and 68 deletions

View file

@ -1,5 +1,4 @@
use leptos::*;
use leptos_icons::*;
use leptos_router::*;
use crate::app::{
models::Post,
@ -75,7 +74,7 @@ pub fn PostListCard(
if post.metadata.draft {
Some(view!{
<div class="warning">
<Icon icon=Icon::from(IoIcon::IoConstruct)/>
<leptos_icons::Icon icon=icondata::IoConstruct/>
</div>
})
} else {
@ -87,7 +86,8 @@ pub fn PostListCard(
<PostTags tags=post.metadata.tags.clone()/>
<h2><A href=format!("/posts/{}", post.metadata.slug.clone())>{post.metadata.title.clone()}</A></h2>
<p>{post.metadata.description.clone()}</p>
<span>{post.metadata.date.clone()}</span>
<span>{post.metadata.date.format("%d-%m-%Y").to_string()}</span>
<span>{post.metadata.reading_time}</span>
</div>
</div>
}
@ -146,7 +146,8 @@ pub fn PostElement() -> impl IntoView {
<img src={post.metadata.image_path.clone()} alt=format!("Image {}", post.metadata.title)/>
<h1>{post.metadata.title.clone()}</h1>
<p>{post.metadata.description.clone()}</p>
<span>{post.metadata.date.clone()}</span>
<span>{post.metadata.date.format("%d-%m-%Y").to_string()}</span>
<span>{post.metadata.reading_time}</span>
<PostTags tags=post.metadata.tags.clone()/>
</div>