yew_bs/components/
stretched_link.rs

1use yew::prelude::*;
2#[derive(Properties, PartialEq)]
3pub struct StretchedLinkProps {
4    pub href: AttrValue,
5    #[prop_or_default]
6    pub children: Children,
7    #[prop_or_default]
8    pub class: Option<AttrValue>,
9    #[prop_or_default]
10    pub target: Option<AttrValue>,
11    #[prop_or_default]
12    pub rel: Option<AttrValue>,
13    #[prop_or_default]
14    pub onclick: Option<Callback<MouseEvent>>,
15}
16#[function_component(StretchedLink)]
17pub fn stretched_link(props: &StretchedLinkProps) -> Html {
18    let mut classes = Classes::new();
19    classes.push("stretched-link");
20    if let Some(custom_class) = &props.class {
21        classes.push(custom_class.to_string());
22    }
23    html! {
24        < a href = { props.href.clone() } class = { classes } target = { props.target
25        .clone() } rel = { props.rel.clone() } onclick = { props.onclick.clone() } > {
26        for props.children.iter() } </ a >
27    }
28}