remote projects per user (#10594)
Release Notes: - Made remote projects per-user instead of per-channel. If you'd like to be part of the remote development alpha, please email hi@zed.dev. --------- Co-authored-by: Bennet Bo Fenner <53836821+bennetbo@users.noreply.github.com> Co-authored-by: Bennet <bennetbo@gmx.de> Co-authored-by: Nate Butler <1714999+iamnbutler@users.noreply.github.com> Co-authored-by: Nate Butler <iamnbutler@gmail.com>
This commit is contained in:
parent
8ae4c3277f
commit
e0c83a1d32
56 changed files with 2807 additions and 1625 deletions
|
@ -44,6 +44,8 @@ pub struct TextField {
|
|||
start_icon: Option<IconName>,
|
||||
/// The layout of the label relative to the text field.
|
||||
with_label: FieldLabelLayout,
|
||||
/// Whether the text field is disabled.
|
||||
disabled: bool,
|
||||
}
|
||||
|
||||
impl FocusableView for TextField {
|
||||
|
@ -72,6 +74,7 @@ impl TextField {
|
|||
editor,
|
||||
start_icon: None,
|
||||
with_label: FieldLabelLayout::Hidden,
|
||||
disabled: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -84,6 +87,16 @@ impl TextField {
|
|||
self.with_label = layout;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn set_disabled(&mut self, disabled: bool, cx: &mut ViewContext<Self>) {
|
||||
self.disabled = disabled;
|
||||
self.editor
|
||||
.update(cx, |editor, _| editor.set_read_only(disabled))
|
||||
}
|
||||
|
||||
pub fn editor(&self) -> &View<Editor> {
|
||||
&self.editor
|
||||
}
|
||||
}
|
||||
|
||||
impl Render for TextField {
|
||||
|
@ -91,17 +104,17 @@ impl Render for TextField {
|
|||
let settings = ThemeSettings::get_global(cx);
|
||||
let theme_color = cx.theme().colors();
|
||||
|
||||
let style = TextFieldStyle {
|
||||
let mut style = TextFieldStyle {
|
||||
text_color: theme_color.text,
|
||||
background_color: theme_color.ghost_element_background,
|
||||
border_color: theme_color.border,
|
||||
};
|
||||
|
||||
// if self.disabled {
|
||||
// style.text_color = theme_color.text_disabled;
|
||||
// style.background_color = theme_color.ghost_element_disabled;
|
||||
// style.border_color = theme_color.border_disabled;
|
||||
// }
|
||||
if self.disabled {
|
||||
style.text_color = theme_color.text_disabled;
|
||||
style.background_color = theme_color.ghost_element_disabled;
|
||||
style.border_color = theme_color.border_disabled;
|
||||
}
|
||||
|
||||
// if self.error_message.is_some() {
|
||||
// style.text_color = cx.theme().status().error;
|
||||
|
@ -131,7 +144,15 @@ impl Render for TextField {
|
|||
.group("text-field")
|
||||
.w_full()
|
||||
.when(self.with_label == FieldLabelLayout::Stacked, |this| {
|
||||
this.child(Label::new(self.label.clone()).size(LabelSize::Default))
|
||||
this.child(
|
||||
Label::new(self.label.clone())
|
||||
.size(LabelSize::Default)
|
||||
.color(if self.disabled {
|
||||
Color::Disabled
|
||||
} else {
|
||||
Color::Muted
|
||||
}),
|
||||
)
|
||||
})
|
||||
.child(
|
||||
v_flex().w_full().child(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue