canonrs-server 0.1.0

CanonRS server-side rendering support
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! @canon-level: strict
//! TableOfContents Boundary — Canon Rule #340 (zero-logic boundary)

use leptos::prelude::*;
use super::table_of_contents_ui::TableOfContents as TableOfContentsUi;
pub use canonrs_core::TocItem;
use canonrs_core::primitives::table_of_contents::TocMode;

#[component]
pub fn TableOfContents(
    items: Vec<TocItem>,
    #[prop(into, default = String::from("On this page"))] title: String,
    #[prop(optional)] mode: Option<TocMode>,
    #[prop(into, default = String::new())] class: String,
) -> impl IntoView {
    let toc_mode = mode.unwrap_or(TocMode::Simple);
    view! { <TableOfContentsUi items=items title=title mode=toc_mode class=class /> }
}