Rust / build (ubuntu-latest, stable) (push) Failing after 12m59s
Rust / build (ubuntu-latest, stable) (pull_request) Failing after 9m53s
Rust / build (macos-latest, stable) (push) Has been cancelled
Rust / build (windows-latest, stable) (push) Has been cancelled
Rust / build (macos-latest, stable) (pull_request) Has been cancelled
Rust / build (windows-latest, stable) (pull_request) Has been cancelled
37 lines
1.1 KiB
Rust
37 lines
1.1 KiB
Rust
use gpui::prelude::FluentBuilder;
|
|
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_1p5()
|
|
.border_1()
|
|
.border_color(cx.theme().border)
|
|
.bg(cx.theme().surface_background)
|
|
.when(cx.theme().shadow, |this| this.shadow_sm())
|
|
.rounded(cx.theme().radius)
|
|
.text_xs()
|
|
.text_color(cx.theme().text)
|
|
.line_height(relative(1.25))
|
|
.child(self.text.clone()),
|
|
)
|
|
}
|
|
}
|