Update Input, Button, Dropdown based on theme.radius

This commit is contained in:
Jason Lee 2024-06-27 23:21:08 +08:00
parent 1a54a47ec8
commit 720672b0e2
4 changed files with 8 additions and 8 deletions

View file

@ -1,5 +1,5 @@
use gpui::{
div, prelude::FluentBuilder as _, ClickEvent, DefiniteLength, Div, ElementId, Hsla,
div, prelude::FluentBuilder as _, px, ClickEvent, DefiniteLength, Div, ElementId, Hsla,
InteractiveElement, IntoElement, MouseButton, ParentElement, RenderOnce, SharedString,
StatefulInteractiveElement as _, Styled, WindowContext,
};
@ -131,9 +131,9 @@ impl RenderOnce for Button {
ButtonSize::Medium => this.px_4().py_2().h_8(),
})
.map(|this| match self.rounded {
ButtonRounded::Small => this.rounded_sm(),
ButtonRounded::Medium => this.rounded_md(),
ButtonRounded::Large => this.rounded_lg(),
ButtonRounded::Small => this.rounded(px(cx.theme().radius * 0.5)),
ButtonRounded::Medium => this.rounded(px(cx.theme().radius)),
ButtonRounded::Large => this.rounded(px(cx.theme().radius * 2.0)),
ButtonRounded::None => this.rounded_none(),
})
.when(!self.disabled, |this| {

View file

@ -173,7 +173,7 @@ where
.bg(cx.theme().background)
.border_1()
.border_color(cx.theme().input)
.rounded_sm()
.rounded(px(cx.theme().radius))
.shadow_sm()
.px_3()
.py_2()
@ -201,7 +201,7 @@ where
.bg(cx.theme().background)
.border_1()
.border_color(cx.theme().input)
.rounded_sm()
.rounded(px(cx.theme().radius))
.shadow_md()
.track_focus(&self.picker.focus_handle(cx))
.child(self.picker.clone()),

View file

@ -603,7 +603,7 @@ impl Render for TextInput {
cx.theme().input
})
.border_1()
.rounded_sm()
.rounded(px(cx.theme().radius))
.shadow_sm()
.px_3()
.bg(if self.disabled {

View file

@ -240,6 +240,7 @@ impl From<Colors> for Theme {
mode: ThemeMode::Dark,
transparent: Hsla::transparent_black(),
font_size: 14.0,
radius: 4.0,
title_bar_background: colors.title_bar_background,
background: colors.background,
foreground: colors.foreground,
@ -261,7 +262,6 @@ impl From<Colors> for Theme {
input: colors.input,
ring: colors.ring,
selection: colors.selection,
radius: 0.0,
}
}
}