use web_sys::MouseEvent; use yew::prelude::*; #[derive(Properties, PartialEq)] pub struct ContextMenuProps { pub is_open: bool, pub x: i32, pub y: i32, pub on_delete: Callback, pub on_close: Callback<()>, } #[function_component(ContextMenu)] pub fn context_menu(props: &ContextMenuProps) -> Html { let menu_ref = use_node_ref(); // Close menu when clicking outside (handled by parent component) if !props.is_open { return html! {}; } let style = format!( "position: fixed; left: {}px; top: {}px; z-index: 1001;", props.x, props.y ); let on_delete_click = { let on_delete = props.on_delete.clone(); let on_close = props.on_close.clone(); Callback::from(move |e: MouseEvent| { on_delete.emit(e); on_close.emit(()); }) }; html! {
{"Delete Calendar"}
} }