use crate::components::{id::PageId, AnyComponent};
#[derive(Clone)]
pub struct ClientPageRoute {
pub(crate) page_id: PageId,
pub(crate) component: AnyComponent<serde_json::Value>, pub(crate) path: String, }
impl ClientPageRoute {
pub fn with_path(self, path: impl Into<String>) -> Self {
ClientPageRoute {
page_id: self.page_id,
component: self.component,
path: path.into(),
}
}
pub fn id(&self) -> &PageId {
&self.page_id
}
pub fn render(&self, props: serde_json::Value) -> yew::Html {
self.component.render_with_props(props)
}
pub fn path(&self) -> &str {
self.path.as_str()
}
}