use crate::consts::{Key, KeyboardKeyType, VirtualKey, Status}; use yew::prelude::*; #[derive(Properties, PartialEq)] pub struct KeyboardProps { pub onclick: Callback, pub keyboard: UseStateHandle>, } #[function_component] pub fn Keyboard(props: &KeyboardProps) -> Html { let handle_click = |k: Key| { let onclick = props.onclick.clone(); Callback::from(move |_| { onclick.emit(k); }).clone() }; html! {
{ for (props.keyboard).iter().map(|vk: &VirtualKey| { match vk.key { KeyboardKeyType::CharKey(c) => html! { }, KeyboardKeyType::Backspace => html! { }, KeyboardKeyType::Enter => html! { } } }) }
} }