assistant2: Add icons to the context pill (#22385)
This PR adds an icon field to the `ContextKind` enum, which means that icons will now display on context pills, both on the message editor and on the active thread. <img width="800" alt="Screenshot 2024-12-24 at 12 23 17 AM" src="https://github.com/user-attachments/assets/f00e540b-30fe-49ac-b3df-7c7a5dc86d65" /> Release Notes: - N/A
This commit is contained in:
parent
44a46e3713
commit
3d4e0780c4
3 changed files with 28 additions and 3 deletions
|
@ -27,15 +27,26 @@ impl ContextPill {
|
|||
|
||||
impl RenderOnce for ContextPill {
|
||||
fn render(self, cx: &mut WindowContext) -> impl IntoElement {
|
||||
let padding_right = if self.on_remove.is_some() {
|
||||
px(2.)
|
||||
} else {
|
||||
px(4.)
|
||||
};
|
||||
|
||||
h_flex()
|
||||
.gap_1()
|
||||
.pl_1p5()
|
||||
.pr_0p5()
|
||||
.pl_1()
|
||||
.pr(padding_right)
|
||||
.pb(px(1.))
|
||||
.border_1()
|
||||
.border_color(cx.theme().colors().border.opacity(0.5))
|
||||
.bg(cx.theme().colors().element_background)
|
||||
.rounded_md()
|
||||
.child(
|
||||
Icon::new(self.context.icon)
|
||||
.size(IconSize::XSmall)
|
||||
.color(Color::Muted),
|
||||
)
|
||||
.child(Label::new(self.context.name.clone()).size(LabelSize::Small))
|
||||
.when_some(self.on_remove, |parent, on_remove| {
|
||||
parent.child(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue