use std::{fmt::Display, str::FromStr}; use yew::prelude::*; use crate::components::nav_bar::NavigationBar; #[function_component(SearchPage)] pub fn search_page(_props: &SearchPageProperties) -> Html { let search_text = use_state(|| String::new()); let clear_search_input = { let search_text = search_text.clone(); Callback::from(move |_| { search_text.set(String::new()) }) }; html!{ <>
// Search bar
// Filters
{"0"}
{"+"}
{"0"}
{"+"}
{"0"}
{"+"}
{"0"}
{"+"}
//TODO: Add a spacing
// Search Results Content
} } #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Properties)] pub struct SearchPageProperties { pub property_state: PropertyState } #[derive(Debug, Clone, Default, PartialEq, Eq, PartialOrd, Ord)] pub enum PropertyState { Finished, #[default] InConstruction, } impl Display for PropertyState { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { PropertyState::Finished => write!(f, "Finished"), PropertyState::InConstruction => write!(f, "InConstruction"), } } } impl FromStr for PropertyState { type Err = (); fn from_str(s: &str) -> Result { match s { "Finished" => Ok(Self::Finished), "InConstruction" => Ok(Self::InConstruction), _ => Err(()) } } }