1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use yew::prelude::*;

#[derive(Properties, PartialEq)]
pub struct ChildrenOnlyProps {
    #[prop_or_default]
    pub class: Classes,
    #[prop_or_default]
    pub children: html::Children,
}

macro_rules! build_component {
    ($name:ident, $tag:tt, $class:literal) => {
        #[function_component($name)]
        pub fn $tag(props: &ChildrenOnlyProps) -> Html {
            html! {
                <$tag class={classes!($class, props.class.clone())}>
                    { props.children.clone() }
                </$tag>
            }
        }
    };
}

build_component!(H1, h1, "bp3-heading");
build_component!(H2, h2, "bp3-heading");
build_component!(H3, h3, "bp3-heading");
build_component!(H4, h4, "bp3-heading");
build_component!(H5, h5, "bp3-heading");
build_component!(H6, h6, "bp3-heading");

build_component!(Blockquote, blockquote, "bp3-blockquote");
build_component!(Code, code, "bp3-code");
build_component!(Label, label, "bp3-label");
build_component!(Pre, pre, "bp3-pre");
build_component!(Ol, ol, "bp3-ol");
build_component!(Ul, ul, "bp3-ul");