ui_storybook/components/primitives/
card.rs1use leptos::prelude::*;
8
9#[component]
10pub fn Card(children: Children) -> impl IntoView {
11 view! {
12 <div class="card">
13 {children()}
14 </div>
15 }
16}
17
18#[component]
19pub fn CardHeader(
20 #[prop(into)] title: String,
21 #[prop(optional, into)] subtitle: String,
22) -> impl IntoView {
23 let has_subtitle = !subtitle.is_empty();
24 view! {
25 <div class="card-header">
26 <div class="card-title">{title}</div>
27 <Show when=move || has_subtitle>
28 <div class="card-subtitle">{subtitle.clone()}</div>
29 </Show>
30 </div>
31 }
32}
33
34#[component]
35pub fn CardBody(children: Children) -> impl IntoView {
36 view! {
37 <div class="card-body">
38 {children()}
39 </div>
40 }
41}