diff --git a/crates/ui-canvas/src/canvas/full_window.rs b/crates/ui-canvas/src/canvas/full_window.rs index b1126c09e..03b79ca73 100644 --- a/crates/ui-canvas/src/canvas/full_window.rs +++ b/crates/ui-canvas/src/canvas/full_window.rs @@ -278,7 +278,7 @@ impl Container for FullWindowDialog<'_> { if self.props.outer_edit { outer::keep(ui.ctx(), cx); } - frame::header(ui, cx, frame::close_action(self.closable), None); + frame::header(ui, cx, frame::close_action(self.closable), None, None); } fn end(&mut self, ui: &mut Ui, cx: &mut BodyCx<'_>) { diff --git a/crates/ui-panels/src/dialog/frame.rs b/crates/ui-panels/src/dialog/frame.rs index 7b537b411..0350c476e 100644 --- a/crates/ui-panels/src/dialog/frame.rs +++ b/crates/ui-panels/src/dialog/frame.rs @@ -7,7 +7,9 @@ use crate::contract::{ Show as _, ShowContainer as _, WordSetCx as _, WrapWidth, }; use crate::contract::{NoValue, Outcome}; +use crate::primitives::IconSpec; use crate::runtime::env::Label; +use crate::style::Ink; use crate::runtime::overlay::CloseReason; use crate::sections::{DialogRole, FooterBar, FooterButton, HeaderAction, HeaderStrength, TitleRow}; use crate::style::{ComponentStyle, StyleCx, SurfaceKind}; @@ -139,8 +141,11 @@ pub struct FooterHost<'s, 'a> { /// Fills the header region: the title, the muted `note` after it when there is one and, for a closable shell, the /// close action. #[doc(hidden)] -pub fn header(ui: &mut Ui, cx: &mut BodyCx<'_>, actions: &[HeaderAction], note: Option<&Label>) { +pub fn header(ui: &mut Ui, cx: &mut BodyCx<'_>, actions: &[HeaderAction], note: Option<&Label>, icon: Option<&craft_behavior::IconId>) { let mut row = TitleRow::new(cx.label()).strength(HeaderStrength::Heading).level(TITLE_LEVEL); + if let Some(icon) = icon { + row = row.icon(IconSpec::svg(icon.clone()).ink(Ink::Accent)); + } if let Some(note) = note { row = row.note(note.clone()); } @@ -323,7 +328,7 @@ impl Component for DialogFrame<'_> { impl Container for DialogFrame<'_> { fn header(&mut self, ui: &mut Ui, cx: &mut BodyCx<'_>) { - header(ui, cx, close_action(self.closable), None); + header(ui, cx, close_action(self.closable), None, None); } fn footer(&mut self, ui: &mut Ui, cx: &mut BodyCx<'_>) { diff --git a/crates/ui-panels/src/dialog/modal.rs b/crates/ui-panels/src/dialog/modal.rs index 59577f382..e736592ea 100644 --- a/crates/ui-panels/src/dialog/modal.rs +++ b/crates/ui-panels/src/dialog/modal.rs @@ -82,6 +82,8 @@ pub struct Dialog<'a> { /// A muted note after the title. #[prop(into)] title_note: Option