
This PR reworks the theme definition in the `theme2` crate to be based off of the new theme work that @iamnbutler has been working on. We're still developing the new theme system, but it is complete enough that we can now load the default theme and use it to theme the storybook (albeit with some further refining of the color palette required). --------- Co-authored-by: Nate Butler <iamnbutler@gmail.com> Co-authored-by: Marshall Bowers <marshall@zed.dev>
40 lines
909 B
Rust
40 lines
909 B
Rust
use gpui2::rems;
|
|
|
|
use crate::prelude::*;
|
|
use crate::{h_stack, Icon};
|
|
|
|
#[derive(Component)]
|
|
pub struct NotificationToast {
|
|
label: SharedString,
|
|
icon: Option<Icon>,
|
|
}
|
|
|
|
impl NotificationToast {
|
|
pub fn new(label: SharedString) -> Self {
|
|
Self { label, icon: None }
|
|
}
|
|
|
|
pub fn icon<I>(mut self, icon: I) -> Self
|
|
where
|
|
I: Into<Option<Icon>>,
|
|
{
|
|
self.icon = icon.into();
|
|
self
|
|
}
|
|
|
|
fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {
|
|
h_stack()
|
|
.z_index(5)
|
|
.absolute()
|
|
.top_1()
|
|
.right_1()
|
|
.w(rems(9999.))
|
|
.max_w_56()
|
|
.py_1()
|
|
.px_1p5()
|
|
.rounded_lg()
|
|
.shadow_md()
|
|
.bg(cx.theme().colors().elevated_surface)
|
|
.child(div().size_full().child(self.label.clone()))
|
|
}
|
|
}
|