onboarding: Add the AI page (#35351)
This PR starts the work on the AI onboarding page as well as the configuration modal Release Notes: - N/A --------- Co-authored-by: Danilo Leal <daniloleal09@gmail.com> Co-authored-by: Anthony <anthony@zed.dev>
This commit is contained in:
co-authored by
Danilo Leal
Anthony
parent
e5c6a596a9
commit
b01d1872cc
@@ -1,5 +1,5 @@
|
||||
use crate::{
|
||||
Clickable, Color, DynamicSpacing, Headline, HeadlineSize, IconButton, IconButtonShape,
|
||||
Clickable, Color, DynamicSpacing, Headline, HeadlineSize, Icon, IconButton, IconButtonShape,
|
||||
IconName, Label, LabelCommon, LabelSize, h_flex, v_flex,
|
||||
};
|
||||
use gpui::{prelude::FluentBuilder, *};
|
||||
@@ -92,6 +92,7 @@ impl RenderOnce for Modal {
|
||||
|
||||
#[derive(IntoElement)]
|
||||
pub struct ModalHeader {
|
||||
icon: Option<Icon>,
|
||||
headline: Option<SharedString>,
|
||||
description: Option<SharedString>,
|
||||
children: SmallVec<[AnyElement; 2]>,
|
||||
@@ -108,6 +109,7 @@ impl Default for ModalHeader {
|
||||
impl ModalHeader {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
icon: None,
|
||||
headline: None,
|
||||
description: None,
|
||||
children: SmallVec::new(),
|
||||
@@ -116,6 +118,11 @@ impl ModalHeader {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn icon(mut self, icon: Icon) -> Self {
|
||||
self.icon = Some(icon);
|
||||
self
|
||||
}
|
||||
|
||||
/// Set the headline of the modal.
|
||||
///
|
||||
/// This will insert the headline as the first item
|
||||
@@ -179,12 +186,17 @@ impl RenderOnce for ModalHeader {
|
||||
)
|
||||
})
|
||||
.child(
|
||||
v_flex().flex_1().children(children).when_some(
|
||||
self.description,
|
||||
|this, description| {
|
||||
v_flex()
|
||||
.flex_1()
|
||||
.child(
|
||||
h_flex()
|
||||
.gap_1()
|
||||
.when_some(self.icon, |this, icon| this.child(icon))
|
||||
.children(children),
|
||||
)
|
||||
.when_some(self.description, |this, description| {
|
||||
this.child(Label::new(description).color(Color::Muted).mb_2())
|
||||
},
|
||||
),
|
||||
}),
|
||||
)
|
||||
.when(self.show_dismiss_button, |this| {
|
||||
this.child(
|
||||
|
||||
Reference in New Issue
Block a user