yggdrasil/components/skeletons/
post_detail_skeleton.rs1use crate::components::skeletons::atoms::*;
6use leptos::prelude::*;
7
8const PARAGRAPH_WIDTHS: [&str; 8] = [
10 "width: 100%",
11 "width: 96%",
12 "width: 88%",
13 "width: 100%",
14 "width: 72%",
15 "width: 94%",
16 "width: 100%",
17 "width: 60%",
18];
19
20#[component]
24pub fn PostDetailBody() -> impl IntoView {
25 view! {
26 <div class="post-header">
27 <SkeletonBox class="h-3 w-28"/>
28 <SkeletonBox class="post-skeleton-title mt-5"/>
29 <SkeletonBox class="post-skeleton-title mt-2.5 w-3/5"/>
30 <SkeletonBox class="h-3 mt-6 w-72 max-w-full"/>
31 </div>
32 <div class="post-skeleton-body">
33 {PARAGRAPH_WIDTHS
34 .iter()
35 .map(|width| view! { <SkeletonBox class="h-3.5" style=*width/> })
36 .collect_view()}
37 <SkeletonBox class="post-skeleton-block"/>
38 </div>
39 }
40}
41
42#[component]
44pub fn PostDetailSkeleton() -> impl IntoView {
45 view! {
46 <div class="post-layout">
47 <article class="post-single" role="status" aria-label="正在加载文章">
48 <PostDetailBody/>
49 </article>
50 </div>
51 }
52}