chore: audit all components #2
+20
-25
@@ -12,7 +12,8 @@ use gpui::{
|
||||
use gpui_native_icons::{IconRole, icon};
|
||||
use gpui_native_theme::ActiveTheme as _;
|
||||
|
||||
use crate::common::DismissHandler;
|
||||
use crate::button::{Button, ButtonVariant};
|
||||
use crate::common::{DismissHandler, Sizable as _};
|
||||
|
||||
/// The action handler of a [`Toast`].
|
||||
pub type ActionHandler = Rc<dyn Fn(&mut App)>;
|
||||
@@ -256,12 +257,13 @@ impl RenderOnce for ToastsView {
|
||||
fn pill(entry: &ToastEntry, toasts: &Entity<Toasts>, cx: &App) -> gpui::Stateful<gpui::Div> {
|
||||
let theme = cx.theme();
|
||||
let surface = theme.colors.surface;
|
||||
let border = theme.colors.border;
|
||||
let border = if theme.borders.overlays {
|
||||
theme.colors.border
|
||||
} else {
|
||||
surface
|
||||
};
|
||||
let foreground = theme.colors.foreground;
|
||||
let muted = theme.colors.muted;
|
||||
let primary = theme.ramps.primary.base;
|
||||
let primary_hover = theme.ramps.primary.hover;
|
||||
let primary_foreground = theme.colors.primary_foreground;
|
||||
let radius = theme.radius.full;
|
||||
let shadows = theme.elevations.popover.shadows();
|
||||
let icon_size = theme.sizes.small.icon_size;
|
||||
@@ -304,25 +306,18 @@ fn pill(entry: &ToastEntry, toasts: &Entity<Toasts>, cx: &App) -> gpui::Stateful
|
||||
.when_some(toast.action.clone(), |pill, action| {
|
||||
let toasts = toasts.clone();
|
||||
pill.child(
|
||||
div()
|
||||
.id(("toast-action", id))
|
||||
.flex_none()
|
||||
.ml_1p5()
|
||||
.cursor_pointer()
|
||||
.px_2()
|
||||
.py_0p5()
|
||||
.rounded(radius)
|
||||
.bg(primary)
|
||||
.hover(|style| style.bg(primary_hover))
|
||||
.text_size(text_size)
|
||||
.text_color(primary_foreground)
|
||||
.child(action.label.clone())
|
||||
.on_click(move |_, _window, cx| {
|
||||
(action.handler.clone())(cx);
|
||||
toasts.update(cx, |toasts, cx| {
|
||||
toasts.dismiss(id, cx);
|
||||
});
|
||||
}),
|
||||
div().flex_none().ml_2p5().child(
|
||||
Button::new(("toast-action", id))
|
||||
.label(action.label.clone())
|
||||
.variant(ButtonVariant::Primary)
|
||||
.small()
|
||||
.on_click(move |_, _window, cx| {
|
||||
(action.handler.clone())(cx);
|
||||
toasts.update(cx, |toasts, cx| {
|
||||
toasts.dismiss(id, cx);
|
||||
});
|
||||
}),
|
||||
),
|
||||
)
|
||||
})
|
||||
.child(
|
||||
@@ -331,7 +326,7 @@ fn pill(entry: &ToastEntry, toasts: &Entity<Toasts>, cx: &App) -> gpui::Stateful
|
||||
.flex_none()
|
||||
.ml_4()
|
||||
.cursor_pointer()
|
||||
.p_0p5()
|
||||
.p_1()
|
||||
.rounded(theme.radius.sm)
|
||||
.hover(|style| style.bg(muted))
|
||||
.child(
|
||||
|
||||
+4
-1
@@ -14,7 +14,6 @@ is the first downstream consumer; its screens drive the order.
|
||||
Platform metric adoption continues one component at a time; each stop goes
|
||||
through the review gate and a gallery pass.
|
||||
|
||||
- [ ] **Toast platform chrome** — overlay border gate.
|
||||
- [ ] **Tooltip platform chrome** — overlay border gate.
|
||||
- [ ] **Alert platform chrome** — overlay border gate.
|
||||
- [ ] **Combobox platform chrome** — popup border behind
|
||||
@@ -115,6 +114,10 @@ Gaps surfaced by the signed comparison; ordered by signed's usage.
|
||||
- [x] Dialog platform chrome — the panel border behind
|
||||
`Theme::borders.overlays` (and dark mode), taking the surface color
|
||||
where the platform paints none
|
||||
- [x] Toast platform chrome — the pill border behind
|
||||
`Theme::borders.overlays` (and dark mode), taking the surface color
|
||||
where the platform paints none; the pill rides the popover elevation,
|
||||
so dark mode's no-shadow rule applies to it too
|
||||
- [x] Button, Checkbox, Switch, Radio + RadioGroup, Toggle, Link, Slider,
|
||||
Progress, Avatar (image + seeded pixel-art fallback)
|
||||
- [x] Spinner — painted ring + rotating-icon variant, indeterminate and
|
||||
|
||||
Reference in New Issue
Block a user