Merge branch 'n/gpui2ui-settings' into gpui2
This commit is contained in:
commit
a6a50113da
9 changed files with 138 additions and 31 deletions
|
@ -3,10 +3,10 @@ use std::marker::PhantomData;
|
|||
use gpui3::{div, Div};
|
||||
|
||||
use crate::prelude::*;
|
||||
use crate::settings::user_settings;
|
||||
use crate::theme::theme;
|
||||
use crate::{
|
||||
h_stack, token, v_stack, Avatar, Icon, IconColor, IconElement, IconSize, Label, LabelColor,
|
||||
LabelSize,
|
||||
h_stack, v_stack, Avatar, Icon, IconColor, IconElement, IconSize, Label, LabelColor, LabelSize,
|
||||
};
|
||||
|
||||
#[derive(Clone, Copy, Default, Debug, PartialEq)]
|
||||
|
@ -94,7 +94,6 @@ impl<S: 'static + Send + Sync + Clone> ListHeader<S> {
|
|||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let theme = theme(cx);
|
||||
let token = token();
|
||||
let system_color = SystemColor::new();
|
||||
let color = ThemeColor::new(cx);
|
||||
|
||||
|
@ -166,7 +165,6 @@ impl<S: 'static + Send + Sync + Clone> ListSubHeader<S> {
|
|||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let theme = theme(cx);
|
||||
let token = token();
|
||||
|
||||
h_stack().flex_1().w_full().relative().py_1().child(
|
||||
div()
|
||||
|
@ -351,7 +349,6 @@ impl<S: 'static + Send + Sync + Clone> ListEntry<S> {
|
|||
cx: &mut ViewContext<S>,
|
||||
) -> Option<impl Element<ViewState = S>> {
|
||||
let theme = theme(cx);
|
||||
let token = token();
|
||||
|
||||
let disclosure_control_icon = if let Some(ToggleState::Toggled) = self.toggle {
|
||||
IconElement::new(Icon::ChevronDown)
|
||||
|
@ -374,9 +371,9 @@ impl<S: 'static + Send + Sync + Clone> ListEntry<S> {
|
|||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let theme = theme(cx);
|
||||
let token = token();
|
||||
let system_color = SystemColor::new();
|
||||
let color = ThemeColor::new(cx);
|
||||
let setting = user_settings();
|
||||
|
||||
let left_content = match self.left_content.clone() {
|
||||
Some(LeftContent::Icon(i)) => Some(
|
||||
|
@ -408,7 +405,7 @@ impl<S: 'static + Send + Sync + Clone> ListEntry<S> {
|
|||
// .ml(rems(0.75 * self.indent_level as f32))
|
||||
.children((0..self.indent_level).map(|_| {
|
||||
div()
|
||||
.w(token.list_indent_depth)
|
||||
.w(*setting.list_indent_depth)
|
||||
.h_full()
|
||||
.flex()
|
||||
.justify_center()
|
||||
|
@ -484,7 +481,6 @@ impl<S: 'static + Send + Sync + Clone> List<S> {
|
|||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let theme = theme(cx);
|
||||
let token = token();
|
||||
let is_toggleable = self.toggleable != Toggleable::NotToggleable;
|
||||
let is_toggled = Toggleable::is_toggled(&self.toggleable);
|
||||
|
||||
|
|
|
@ -3,8 +3,9 @@ use std::marker::PhantomData;
|
|||
use gpui3::{AbsoluteLength, AnyElement};
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use crate::settings::user_settings;
|
||||
use crate::v_stack;
|
||||
use crate::{prelude::*, theme};
|
||||
use crate::{token, v_stack};
|
||||
|
||||
#[derive(Default, Debug, PartialEq, Eq, Hash, Clone, Copy)]
|
||||
pub enum PanelAllowedSides {
|
||||
|
@ -53,14 +54,14 @@ pub struct Panel<S: 'static + Send + Sync> {
|
|||
|
||||
impl<S: 'static + Send + Sync> Panel<S> {
|
||||
pub fn new(scroll_state: ScrollState) -> Self {
|
||||
let token = token();
|
||||
let setting = user_settings();
|
||||
|
||||
Self {
|
||||
state_type: PhantomData,
|
||||
scroll_state,
|
||||
current_side: PanelSide::default(),
|
||||
allowed_sides: PanelAllowedSides::default(),
|
||||
initial_width: token.default_panel_size,
|
||||
initial_width: *setting.default_panel_size,
|
||||
width: None,
|
||||
children: SmallVec::new(),
|
||||
}
|
||||
|
@ -96,7 +97,6 @@ impl<S: 'static + Send + Sync> Panel<S> {
|
|||
}
|
||||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let token = token();
|
||||
let theme = theme(cx);
|
||||
|
||||
let panel_base;
|
||||
|
|
|
@ -4,6 +4,7 @@ use std::sync::Arc;
|
|||
use gpui3::{view, Context, View};
|
||||
|
||||
use crate::prelude::*;
|
||||
use crate::settings::user_settings;
|
||||
use crate::{
|
||||
random_players_with_call_status, theme, Avatar, Button, Icon, IconButton, IconColor, MicStatus,
|
||||
PlayerStack, PlayerWithCallStatus, ScreenShareStatus, ToolDivider, TrafficLights,
|
||||
|
@ -93,6 +94,9 @@ impl TitleBar {
|
|||
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element<ViewState = Self> {
|
||||
let theme = theme(cx);
|
||||
let color = ThemeColor::new(cx);
|
||||
let setting = user_settings();
|
||||
|
||||
// let has_focus = cx.window_is_active();
|
||||
let has_focus = true;
|
||||
|
||||
|
@ -107,8 +111,7 @@ impl TitleBar {
|
|||
.items_center()
|
||||
.justify_between()
|
||||
.w_full()
|
||||
.h_8()
|
||||
.bg(theme.lowest.base.default.background)
|
||||
.bg(color.background)
|
||||
.child(
|
||||
div()
|
||||
.flex()
|
||||
|
@ -123,6 +126,9 @@ impl TitleBar {
|
|||
.flex()
|
||||
.items_center()
|
||||
.gap_1()
|
||||
.when(*setting.titlebar.show_project_owner, |this| {
|
||||
this.child(Button::new("iamnbutler"))
|
||||
})
|
||||
.child(Button::new("zed"))
|
||||
.child(Button::new("nate/gpui2-ui-components")),
|
||||
)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::marker::PhantomData;
|
||||
|
||||
use crate::prelude::*;
|
||||
use crate::{theme, token, SystemColor};
|
||||
use crate::{theme, SystemColor};
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
enum TrafficLightColor {
|
||||
|
@ -62,7 +62,6 @@ impl<S: 'static + Send + Sync> TrafficLights<S> {
|
|||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
let theme = theme(cx);
|
||||
let token = token();
|
||||
|
||||
div()
|
||||
.flex()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue