thaw/layout/
layout_sider.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use crate::Scrollbar;
use leptos::prelude::*;
use thaw_utils::{class_list, mount_style};

#[component]
pub fn LayoutSider(
    #[prop(optional, into)] class: MaybeProp<String>,
    /// Addtional classes for the scroll element.
    #[prop(optional, into)]
    content_class: MaybeProp<String>,
    /// Style of scrollable content node.
    #[prop(optional, into)]
    content_style: MaybeProp<String>,
    children: Children,
) -> impl IntoView {
    mount_style("layout-sider", include_str!("./layout-sider.css"));
    view! {
        <div class=class_list!["thaw-layout-sider", class]>
            <Scrollbar content_class content_style>
                {children()}
            </Scrollbar>
        </div>
    }
}