Files
coop/crates/ui/src/tooltip.rs
reya ede41c41c3 chore: improve the event loop (#141)
* improve wait for signer

* refactor gift wrap processor

* .

* .

* .

* .

* .
2025-09-05 19:01:26 +07:00

36 lines
1003 B
Rust

use gpui::{
div, relative, App, AppContext, Context, Entity, IntoElement, ParentElement, Render,
SharedString, Styled, Window,
};
use theme::ActiveTheme;
pub struct Tooltip {
text: SharedString,
}
impl Tooltip {
pub fn new(text: impl Into<SharedString>, _window: &mut Window, cx: &mut App) -> Entity<Self> {
cx.new(|_| Self { text: text.into() })
}
}
impl Render for Tooltip {
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
div().child(
div()
.font_family(".SystemUIFont")
.m_3()
.p_2()
.border_1()
.border_color(cx.theme().border)
.bg(cx.theme().surface_background)
.shadow_md()
.rounded_lg()
.text_sm()
.text_color(cx.theme().text_muted)
.line_height(relative(1.25))
.child(self.text.clone()),
)
}
}