htmx_components/server/
headers.rs1use super::html_element::HtmlElement;
2use rscx::{component, html, props};
3use rscx_web_macros::*;
4
5#[html_element]
6pub struct SecondaryHeaderProps {
7 #[builder(setter(into))]
8 title: String,
9
10 #[builder(setter(into), default)]
11 subtitle: String,
12
13 #[builder(default)]
14 children: String,
15
16 #[builder(setter(into), default=String::from("header"))]
17 tag: String,
18}
19
20#[component]
21pub fn SecondaryHeader(props: SecondaryHeaderProps) -> String {
22 html! {
23 <HtmlElement
24 tag=props.tag
25 attrs=spread_attrs!(props)
26 >
27 <h2
28 class="text-lg font-medium leading-6 text-gray-900"
29 >
30 {props.title}
31 </h2>
32 {
33 if !props.subtitle.is_empty() {
34 html! {
35 <p class="mt-1 text-sm text-gray-500">{props.subtitle}</p>
36 }
37 } else {
38 "".into()
39 }
40 }
41 {props.children}
42 </HtmlElement>
43 }
44}