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
|
@ -1,7 +1,7 @@
|
|||
use gpui::{svg, IntoElement, Rems, Transformation};
|
||||
use gpui::{svg, Hsla, IntoElement, Rems, Transformation};
|
||||
use strum::EnumIter;
|
||||
|
||||
use crate::prelude::*;
|
||||
use crate::{prelude::*, Indicator};
|
||||
|
||||
#[derive(Default, PartialEq, Copy, Clone)]
|
||||
pub enum IconSize {
|
||||
|
@ -283,3 +283,63 @@ impl RenderOnce for Icon {
|
|||
.text_color(self.color.color(cx))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(IntoElement)]
|
||||
pub struct IconWithIndicator {
|
||||
icon: Icon,
|
||||
indicator: Option<Indicator>,
|
||||
indicator_border_color: Option<Hsla>,
|
||||
}
|
||||
|
||||
impl IconWithIndicator {
|
||||
pub fn new(icon: Icon, indicator: Option<Indicator>) -> Self {
|
||||
Self {
|
||||
icon,
|
||||
indicator,
|
||||
indicator_border_color: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn indicator(mut self, indicator: Option<Indicator>) -> Self {
|
||||
self.indicator = indicator;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn indicator_color(mut self, color: Color) -> Self {
|
||||
if let Some(indicator) = self.indicator.as_mut() {
|
||||
indicator.color = color;
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
pub fn indicator_border_color(mut self, color: Option<Hsla>) -> Self {
|
||||
self.indicator_border_color = color;
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl RenderOnce for IconWithIndicator {
|
||||
fn render(self, cx: &mut WindowContext) -> impl IntoElement {
|
||||
let indicator_border_color = self
|
||||
.indicator_border_color
|
||||
.unwrap_or_else(|| cx.theme().colors().elevated_surface_background);
|
||||
|
||||
div()
|
||||
.relative()
|
||||
.child(self.icon)
|
||||
.when_some(self.indicator, |this, indicator| {
|
||||
this.child(
|
||||
div()
|
||||
.absolute()
|
||||
.w_2()
|
||||
.h_2()
|
||||
.border()
|
||||
.border_color(indicator_border_color)
|
||||
.rounded_full()
|
||||
.neg_bottom_0p5()
|
||||
.neg_right_1()
|
||||
.child(indicator),
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue