Skip to main content

email_components/components/
email_html.rs

1use yew::{AttrValue, Properties, function_component};
2
3pub const HEAD_PLACEHOLDER: &str = "###HEAD_PLACEHOLDER###";
4
5#[derive(Properties, PartialEq)]
6pub struct Props {
7    #[prop_or(AttrValue::Static("en"))]
8    pub lang: AttrValue,
9    #[prop_or(AttrValue::Static("ltr"))]
10    pub dir: AttrValue,
11
12    pub children: yew::Html,
13}
14
15#[function_component]
16pub fn EmailHtml(props: &Props) -> yew::Html {
17    let Props {
18        lang,
19        dir,
20        children,
21    } = props;
22
23    yew::html! {
24        <html lang={lang} dir={dir}>
25            <head>
26                <meta charset="utf-8" />
27                { HEAD_PLACEHOLDER }
28            </head>
29            <body>{ children.clone() }</body>
30        </html>
31    }
32}