htmx_components/server/
page_header.rs

1use super::html_element::HtmlElement;
2use rscx::{component, html, props};
3use rscx_web_macros::*;
4
5#[html_element]
6pub struct PageHeaderToolbarProps {
7    #[builder(setter(into))]
8    title: String,
9    buttons: String,
10}
11
12#[component]
13pub fn PageHeaderToolbar(props: PageHeaderToolbarProps) -> String {
14    html! {
15        <HtmlElement
16            tag="header"
17            class=props.class
18            component_name="PageHeaderToolbar"
19            attrs=spread_attrs!(props | omit(class))
20        >
21            <div class="mt-2 md:flex md:items-center md:justify-between">
22                <div class="min-w-0 flex-1">
23                    <h2 class="text-2xl font-bold leading-7 text-gray-900 sm:truncate sm:text-3xl sm:tracking-tight">{props.title}</h2>
24                </div>
25                <div class="mt-4 flex flex-shrink-0 gap-2 md:ml-4 md:mt-0">
26                    {props.buttons}
27                </div>
28            </div>
29        </HtmlElement>
30    }
31}