T09a overlays: popover, hover card, dialog with fullscreen, alert, confirm and prompt dialogs; shared severity; tooltip, sheet and drawer point to their homes
This commit is contained in:
17 files changed
+1750
-16
No files matched your search
@@ -6,6 +6,7 @@ mod icon;
|
||||
mod image;
|
||||
mod measure;
|
||||
mod pressable;
|
||||
mod severity;
|
||||
mod tooltip;
|
||||
|
||||
pub use backdrop::{Backdrop, Place};
|
||||
@@ -17,4 +18,5 @@ pub use icon::{Icon, IconName};
|
||||
pub use image::Image;
|
||||
pub use measure::{IntersectionObserver, Measure};
|
||||
pub use pressable::Pressable;
|
||||
pub use severity::Severity;
|
||||
pub use tooltip::{Tooltip, TooltipTrigger};
|
||||
@@ -0,0 +1,43 @@
|
||||
use gpui::Hsla;
|
||||
|
||||
use super::IconName;
|
||||
use crate::theme::Palette;
|
||||
|
||||
/// How much a message matters, with the color and icon that say so.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum Severity {
|
||||
Info,
|
||||
Success,
|
||||
Warning,
|
||||
Danger,
|
||||
}
|
||||
|
||||
impl Severity {
|
||||
pub fn color(self, colors: &Palette) -> Hsla {
|
||||
match self {
|
||||
Self::Info => colors.info,
|
||||
Self::Success => colors.success,
|
||||
Self::Warning => colors.warning,
|
||||
Self::Danger => colors.danger,
|
||||
}
|
||||
}
|
||||
|
||||
/// The quiet fill behind its icon or a banner.
|
||||
pub fn subtle(self, colors: &Palette) -> Hsla {
|
||||
match self {
|
||||
Self::Info => colors.info_subtle,
|
||||
Self::Success => colors.success_subtle,
|
||||
Self::Warning => colors.warning_subtle,
|
||||
Self::Danger => colors.danger_subtle,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn icon(self) -> IconName {
|
||||
match self {
|
||||
Self::Info => IconName::Info,
|
||||
Self::Success => IconName::CircleCheck,
|
||||
Self::Warning => IconName::TriangleAlert,
|
||||
Self::Danger => IconName::CircleAlert,
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user