WIP: remoting (#10085)
Release Notes: - Added private alpha support for remote development. Please reach out to hi@zed.dev if you'd like to be part of shaping this feature.
This commit is contained in:
parent
ea4419076e
commit
f6c85b28d5
54 changed files with 4117 additions and 759 deletions
|
@ -106,12 +106,14 @@ pub enum IconName {
|
|||
Settings,
|
||||
Screen,
|
||||
SelectAll,
|
||||
Server,
|
||||
Shift,
|
||||
Snip,
|
||||
Space,
|
||||
Split,
|
||||
Tab,
|
||||
Terminal,
|
||||
Trash,
|
||||
Update,
|
||||
WholeWord,
|
||||
XCircle,
|
||||
|
@ -202,12 +204,14 @@ impl IconName {
|
|||
IconName::Settings => "icons/file_icons/settings.svg",
|
||||
IconName::Screen => "icons/desktop.svg",
|
||||
IconName::SelectAll => "icons/select_all.svg",
|
||||
IconName::Server => "icons/server.svg",
|
||||
IconName::Shift => "icons/shift.svg",
|
||||
IconName::Snip => "icons/snip.svg",
|
||||
IconName::Space => "icons/space.svg",
|
||||
IconName::Split => "icons/split.svg",
|
||||
IconName::Tab => "icons/tab.svg",
|
||||
IconName::Terminal => "icons/terminal.svg",
|
||||
IconName::Trash => "icons/trash.svg",
|
||||
IconName::Update => "icons/update.svg",
|
||||
IconName::WholeWord => "icons/word_search.svg",
|
||||
IconName::XCircle => "icons/error.svg",
|
||||
|
|
133
crates/ui/src/components/modal.rs
Normal file
133
crates/ui/src/components/modal.rs
Normal file
|
@ -0,0 +1,133 @@
|
|||
use gpui::*;
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use crate::{h_flex, IconButton, IconButtonShape, IconName, Label, LabelCommon, LabelSize};
|
||||
|
||||
#[derive(IntoElement)]
|
||||
pub struct ModalHeader {
|
||||
id: ElementId,
|
||||
children: SmallVec<[AnyElement; 2]>,
|
||||
}
|
||||
|
||||
impl ModalHeader {
|
||||
pub fn new(id: impl Into<ElementId>) -> Self {
|
||||
Self {
|
||||
id: id.into(),
|
||||
children: SmallVec::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ParentElement for ModalHeader {
|
||||
fn extend(&mut self, elements: impl Iterator<Item = AnyElement>) {
|
||||
self.children.extend(elements)
|
||||
}
|
||||
}
|
||||
|
||||
impl RenderOnce for ModalHeader {
|
||||
fn render(self, _cx: &mut WindowContext) -> impl IntoElement {
|
||||
h_flex()
|
||||
.id(self.id)
|
||||
.w_full()
|
||||
.px_2()
|
||||
.py_1p5()
|
||||
.child(div().flex_1().children(self.children))
|
||||
.justify_between()
|
||||
.child(IconButton::new("dismiss", IconName::Close).shape(IconButtonShape::Square))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(IntoElement)]
|
||||
pub struct ModalContent {
|
||||
children: SmallVec<[AnyElement; 2]>,
|
||||
}
|
||||
|
||||
impl ModalContent {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
children: SmallVec::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ParentElement for ModalContent {
|
||||
fn extend(&mut self, elements: impl Iterator<Item = AnyElement>) {
|
||||
self.children.extend(elements)
|
||||
}
|
||||
}
|
||||
|
||||
impl RenderOnce for ModalContent {
|
||||
fn render(self, _cx: &mut WindowContext) -> impl IntoElement {
|
||||
h_flex().w_full().px_2().py_1p5().children(self.children)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(IntoElement)]
|
||||
pub struct ModalRow {
|
||||
children: SmallVec<[AnyElement; 2]>,
|
||||
}
|
||||
|
||||
impl ModalRow {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
children: SmallVec::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ParentElement for ModalRow {
|
||||
fn extend(&mut self, elements: impl Iterator<Item = AnyElement>) {
|
||||
self.children.extend(elements)
|
||||
}
|
||||
}
|
||||
|
||||
impl RenderOnce for ModalRow {
|
||||
fn render(self, _cx: &mut WindowContext) -> impl IntoElement {
|
||||
h_flex().w_full().px_2().py_1().children(self.children)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(IntoElement)]
|
||||
pub struct SectionHeader {
|
||||
/// The label of the header.
|
||||
label: SharedString,
|
||||
/// A slot for content that appears after the label, usually on the other side of the header.
|
||||
/// This might be a button, a disclosure arrow, a face pile, etc.
|
||||
end_slot: Option<AnyElement>,
|
||||
}
|
||||
|
||||
impl SectionHeader {
|
||||
pub fn new(label: impl Into<SharedString>) -> Self {
|
||||
Self {
|
||||
label: label.into(),
|
||||
end_slot: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn end_slot<E: IntoElement>(mut self, end_slot: impl Into<Option<E>>) -> Self {
|
||||
self.end_slot = end_slot.into().map(IntoElement::into_any_element);
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl RenderOnce for SectionHeader {
|
||||
fn render(self, _cx: &mut WindowContext) -> impl IntoElement {
|
||||
h_flex().id(self.label.clone()).w_full().child(
|
||||
div()
|
||||
.h_7()
|
||||
.flex()
|
||||
.items_center()
|
||||
.justify_between()
|
||||
.w_full()
|
||||
.gap_1()
|
||||
.child(
|
||||
div().flex_1().child(
|
||||
Label::new(self.label.clone())
|
||||
.size(LabelSize::Large)
|
||||
.into_element(),
|
||||
),
|
||||
)
|
||||
.child(h_flex().children(self.end_slot)),
|
||||
)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue