First import
This commit is contained in:
1
template/web/src/components/mod.rs
Normal file
1
template/web/src/components/mod.rs
Normal file
@@ -0,0 +1 @@
|
||||
pub mod object;
|
||||
23
template/web/src/components/object.rs
Normal file
23
template/web/src/components/object.rs
Normal file
@@ -0,0 +1,23 @@
|
||||
use {{crate_name}};
|
||||
use uikit_rs as uk;
|
||||
use yew::{classes, function_component, html, Properties};
|
||||
|
||||
#[derive(Properties, PartialEq)]
|
||||
pub struct ObjectProps {
|
||||
#[prop_or_default]
|
||||
pub object: Option<{{crate_name}}::Object>,
|
||||
}
|
||||
|
||||
#[function_component(Object)]
|
||||
pub fn object(ObjectProps { object }: &ObjectProps) -> Html {
|
||||
html! {
|
||||
<span class={classes!(uk::Text::Meta)}>
|
||||
{
|
||||
match object {
|
||||
Some(obj) => format!("object: {}", obj.name ),
|
||||
None => "No object".to_string()
|
||||
}
|
||||
}
|
||||
</span>
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user