feat: improve compose modal
This commit is contained in:
@@ -353,7 +353,7 @@ impl RenderOnce for Button {
|
||||
Size::Size(size) => this.px(size * 0.2),
|
||||
Size::XSmall => this.h_6().px_0p5(),
|
||||
Size::Small => this.h_8().px_2(),
|
||||
_ => this.h_10().px_4(),
|
||||
_ => this.h_9().px_3(),
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -487,7 +487,7 @@ impl ButtonVariant {
|
||||
|
||||
fn text_color(&self, cx: &WindowContext) -> Hsla {
|
||||
match self {
|
||||
ButtonVariant::Primary => cx.theme().accent.step(cx, ColorScaleStep::ONE),
|
||||
ButtonVariant::Primary => cx.theme().base.step(cx, ColorScaleStep::TWELVE),
|
||||
ButtonVariant::Link => cx.theme().accent.step(cx, ColorScaleStep::NINE),
|
||||
ButtonVariant::Custom(colors) => colors.foreground,
|
||||
_ => cx.theme().base.step(cx, ColorScaleStep::TWELVE),
|
||||
|
||||
@@ -72,7 +72,7 @@ pub trait DropdownDelegate: Sized {
|
||||
Self::Item: DropdownItem<Value = V>,
|
||||
V: PartialEq,
|
||||
{
|
||||
(0..self.len()).find(|&i| self.get(i).map_or(false, |item| item.value() == value))
|
||||
(0..self.len()).find(|&i| self.get(i).is_some_and(|item| item.value() == value))
|
||||
}
|
||||
|
||||
fn can_search(&self) -> bool {
|
||||
@@ -125,9 +125,7 @@ where
|
||||
}
|
||||
|
||||
fn render_item(&self, ix: usize, cx: &mut gpui::ViewContext<List<Self>>) -> Option<Self::Item> {
|
||||
let selected = self
|
||||
.selected_index
|
||||
.map_or(false, |selected_index| selected_index == ix);
|
||||
let selected = self.selected_index == Some(ix);
|
||||
let size = self
|
||||
.dropdown
|
||||
.upgrade()
|
||||
|
||||
@@ -2,7 +2,7 @@ use crate::{
|
||||
animation::cubic_bezier,
|
||||
button::{Button, ButtonVariants as _},
|
||||
theme::{scale::ColorScaleStep, ActiveTheme as _},
|
||||
v_flex, ContextModal, IconName, Sizable as _,
|
||||
v_flex, ContextModal, IconName, Sizable as _, StyledExt,
|
||||
};
|
||||
use gpui::{
|
||||
actions, anchored, div, hsla, point, prelude::FluentBuilder, px, relative, Animation,
|
||||
@@ -219,7 +219,13 @@ impl RenderOnce for Modal {
|
||||
.w(self.width)
|
||||
.when_some(self.max_width, |this, w| this.max_w(w))
|
||||
.when_some(self.title, |this, title| {
|
||||
this.child(div().line_height(relative(1.)).child(title))
|
||||
this.child(
|
||||
div()
|
||||
.text_sm()
|
||||
.font_semibold()
|
||||
.line_height(relative(1.))
|
||||
.child(title),
|
||||
)
|
||||
})
|
||||
.when(self.show_close, |this| {
|
||||
this.child(
|
||||
|
||||
Reference in New Issue
Block a user