use yew::prelude::*; use web_sys::MouseEvent; #[derive(Properties, PartialEq)] pub struct EventContextMenuProps { pub is_open: bool, pub x: i32, pub y: i32, pub on_delete: Callback, pub on_close: Callback<()>, } #[function_component(EventContextMenu)] pub fn event_context_menu(props: &EventContextMenuProps) -> Html { let menu_ref = use_node_ref(); 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 Event"}
} }