31 lines
672 B
Rust
31 lines
672 B
Rust
use gpui::{div, Div, ParentElement, Render, SharedString, Styled, ViewContext};
|
|
use theme2::ActiveTheme;
|
|
|
|
use crate::StyledExt;
|
|
|
|
#[derive(Clone, Debug)]
|
|
pub struct TextTooltip {
|
|
title: SharedString,
|
|
}
|
|
|
|
impl TextTooltip {
|
|
pub fn new(str: SharedString) -> Self {
|
|
Self { title: str }
|
|
}
|
|
}
|
|
|
|
impl Render for TextTooltip {
|
|
type Element = Div<Self>;
|
|
|
|
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
|
|
div()
|
|
.elevation_2(cx)
|
|
.font("Zed Sans")
|
|
.text_ui()
|
|
.text_color(cx.theme().colors().text)
|
|
.py_1()
|
|
.px_2()
|
|
.child(self.title.clone())
|
|
}
|
|
}
|