yggdrasil/src/components/post/post_meta.rs

27 lines
598 B
Rust
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//! 文章元信息组件
//!
//! 展示文章发布日期、阅读时长与字数统计。
use dioxus::prelude::*;
use crate::models::post::Post;
/// 文章元信息组件。
///
/// Props
/// - `post`:文章数据模型
///
/// 渲染格式:`日期 · min read · words`
#[component]
pub fn PostMeta(post: Post) -> Element {
rsx! {
div { class: "post-meta",
span { "{post.formatted_date()}" }
span { "·" }
span { "{post.reading_time} min read" }
span { "·" }
span { "{post.word_count} words" }
}
}
}