chore: Move shadow_xs to StyledExt trait. (#1010)
This PR for fix https://github.com/longbridge/gpui-component/pull/1009 mistake.
This commit is contained in:
parent
c8481bee19
commit
692ee83b61
11 changed files with 30 additions and 31 deletions
|
|
@ -5,7 +5,7 @@ use gpui::{
|
|||
use gpui_component::{
|
||||
button::{Button, ButtonVariant, ButtonVariants},
|
||||
dock::PanelControl,
|
||||
gray_500, green_500, h_flex, red_500, v_flex, Icon, IconName,
|
||||
green_500, h_flex, neutral_500, red_500, v_flex, Icon, IconName,
|
||||
};
|
||||
|
||||
use crate::section;
|
||||
|
|
@ -80,7 +80,11 @@ impl Render for IconStory {
|
|||
.gap_4()
|
||||
.child(
|
||||
Button::new("like1")
|
||||
.icon(Icon::new(IconName::Heart).text_color(gray_500()).size_6())
|
||||
.icon(
|
||||
Icon::new(IconName::Heart)
|
||||
.text_color(neutral_500())
|
||||
.size_6(),
|
||||
)
|
||||
.with_variant(ButtonVariant::Ghost),
|
||||
)
|
||||
.child(
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use gpui::{
|
|||
};
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
|
||||
use crate::{h_flex, ActiveTheme, Disableable, Icon, Sizable, Size, StyleSized as _, StyledExt};
|
||||
use crate::{h_flex, ActiveTheme, Disableable, Icon, Sizable, Size, StyledExt};
|
||||
|
||||
#[derive(Default, Copy, Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub enum ToggleVariant {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{
|
||||
text::Text, v_flex, ActiveTheme, Disableable, IconName, Selectable, Sizable, Size,
|
||||
StyleSized as _, StyledExt as _,
|
||||
StyledExt as _,
|
||||
};
|
||||
use gpui::{
|
||||
div, prelude::FluentBuilder as _, px, relative, rems, svg, AnyElement, App, Div, ElementId,
|
||||
|
|
|
|||
|
|
@ -187,8 +187,8 @@ impl ColorPicker {
|
|||
state: state.clone(),
|
||||
featured_colors: vec![
|
||||
crate::black(),
|
||||
crate::gray_600(),
|
||||
crate::gray_400(),
|
||||
crate::neutral_600(),
|
||||
crate::neutral_400(),
|
||||
crate::white(),
|
||||
crate::red_600(),
|
||||
crate::orange_600(),
|
||||
|
|
|
|||
|
|
@ -338,17 +338,17 @@ impl StatusColors {
|
|||
|
||||
#[inline]
|
||||
pub fn hint(&self) -> Hsla {
|
||||
self.hint.unwrap_or(crate::gray_500())
|
||||
self.hint.unwrap_or(crate::neutral_500())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn hint_background(&self) -> Hsla {
|
||||
self.hint_background.unwrap_or(crate::gray_200())
|
||||
self.hint_background.unwrap_or(crate::neutral_200())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn hint_border(&self) -> Hsla {
|
||||
self.hint_border.unwrap_or(crate::gray_500())
|
||||
self.hint_border.unwrap_or(crate::neutral_500())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use crate::{
|
|||
highlighter::LanguageRegistry,
|
||||
input::{InputState, Marker},
|
||||
text::TextView,
|
||||
ActiveTheme as _, StyleSized as _,
|
||||
ActiveTheme as _, StyledExt as _,
|
||||
};
|
||||
|
||||
pub struct DiagnosticPopover {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use gpui::{
|
|||
};
|
||||
|
||||
use super::{blink_cursor::BlinkCursor, InputEvent};
|
||||
use crate::{h_flex, v_flex, ActiveTheme, Icon, IconName, Sizable, Size, StyleSized as _};
|
||||
use crate::{h_flex, v_flex, ActiveTheme, Icon, IconName, Sizable, Size, StyledExt as _};
|
||||
|
||||
pub struct OtpState {
|
||||
focus_handle: FocusHandle,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
use std::rc::Rc;
|
||||
|
||||
use crate::{
|
||||
h_flex, text::Text, v_flex, ActiveTheme, AxisExt, IconName, StyleSized as _, StyledExt,
|
||||
};
|
||||
use crate::{h_flex, text::Text, v_flex, ActiveTheme, AxisExt, IconName, StyledExt};
|
||||
use gpui::{
|
||||
div, prelude::FluentBuilder, relative, svg, AnyElement, App, Axis, Div, ElementId,
|
||||
InteractiveElement, IntoElement, ParentElement, RenderOnce, SharedString,
|
||||
|
|
|
|||
|
|
@ -170,6 +170,17 @@ pub trait StyledExt: Styled + Sized {
|
|||
.shadow_lg()
|
||||
.rounded(cx.theme().radius)
|
||||
}
|
||||
|
||||
/// TODO: Remove this after PR is merged
|
||||
/// https://github.com/zed-industries/zed/pull/33361
|
||||
fn shadow_xs(self) -> Self {
|
||||
self.shadow(vec![BoxShadow {
|
||||
color: hsla(0., 0., 0., 0.05),
|
||||
offset: point(px(0.), px(1.)),
|
||||
blur_radius: px(2.),
|
||||
spread_radius: px(0.),
|
||||
}])
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: Styled> StyledExt for E {}
|
||||
|
|
@ -358,7 +369,6 @@ pub trait Sizable: Sized {
|
|||
|
||||
#[allow(unused)]
|
||||
pub trait StyleSized<T: Styled> {
|
||||
fn shadow_xs(self) -> Self;
|
||||
fn input_text_size(self, size: Size) -> Self;
|
||||
fn input_size(self, size: Size) -> Self;
|
||||
fn input_pl(self, size: Size) -> Self;
|
||||
|
|
@ -480,17 +490,6 @@ impl<T: Styled> StyleSized<T> for T {
|
|||
_ => self.text_base(),
|
||||
}
|
||||
}
|
||||
|
||||
/// TODO: Remove this after PR is merged
|
||||
/// https://github.com/zed-industries/zed/pull/33361
|
||||
fn shadow_xs(self) -> Self {
|
||||
self.shadow(vec![BoxShadow {
|
||||
color: hsla(0., 0., 0., 0.05),
|
||||
offset: point(px(0.), px(1.)),
|
||||
blur_radius: px(2.),
|
||||
spread_radius: px(0.),
|
||||
}])
|
||||
}
|
||||
}
|
||||
|
||||
pub trait AxisExt {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use crate::{
|
||||
h_flex, ActiveTheme, Icon, IconName, Selectable, Sizable, Size, StyleSized as _, StyledExt,
|
||||
};
|
||||
use crate::{h_flex, ActiveTheme, Icon, IconName, Selectable, Sizable, Size, StyledExt};
|
||||
use gpui::prelude::FluentBuilder as _;
|
||||
use gpui::{
|
||||
div, px, AnyElement, App, ClickEvent, Div, Edges, ElementId, Hsla, InteractiveElement,
|
||||
|
|
|
|||
|
|
@ -349,7 +349,7 @@ impl ThemeColor {
|
|||
warning_hover: yellow_500().opacity(0.9),
|
||||
warning_foreground: gray_50(),
|
||||
overlay: black().opacity(0.05),
|
||||
window_border: neutral_300(),
|
||||
window_border: neutral_200(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -448,7 +448,7 @@ impl ThemeColor {
|
|||
warning_foreground: yellow_50(),
|
||||
warning_hover: yellow_900().lighten(0.1),
|
||||
overlay: white().opacity(0.03),
|
||||
window_border: neutral_700(),
|
||||
window_border: neutral_800(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue