yggdrasil/components/post/
post_header.rs1use dioxus::prelude::*;
6
7use crate::components::post::breadcrumbs::Breadcrumbs;
8use crate::components::post::post_meta::PostMeta;
9use crate::models::post::{Post, PostStatus};
10
11#[component]
22pub fn PostHeader(post: Post) -> Element {
23 rsx! {
24 header { class: "post-header",
25 Breadcrumbs { title: post.title.clone() }
26
27 h1 { class: "post-title",
28 "{post.title}"
29 if post.status == PostStatus::Draft {
30 span { class: "entry-hint", title: "Draft",
31 svg {
32 xmlns: "http://www.w3.org/2000/svg",
33 height: "35",
34 view_box: "0 -960 960 960",
35 fill: "currentColor",
36 path { d: "M160-410v-60h300v60H160Zm0-165v-60h470v60H160Zm0-165v-60h470v60H160Zm360 580v-123l221-220q9-9 20-13t22-4q12 0 23 4.5t20 13.5l37 37q9 9 13 20t4 22q0 11-4.5 22.5T862.09-380L643-160H520Zm300-263-37-37 37 37ZM580-220h38l121-122-18-19-19-18-122 121v38Zm141-141-19-18 37 37-18-19Z" }
37 }
38 }
39 }
40 }
41
42 if let Some(summary) = &post.summary {
43 div { class: "post-description", "{summary}" }
44 }
45
46 PostMeta { post: post.clone() }
47 }
48 }
49}