mirror of
https://github.com/librekeys/picoforge.git
synced 2026-07-28 08:01:19 -07:00
chore(ui): add borders to button component
This commit is contained in:
+20
-13
@@ -1,10 +1,11 @@
|
||||
#![allow(unused)]
|
||||
|
||||
use crate::ui::colors;
|
||||
use gpui::Styled;
|
||||
use gpui::prelude::*;
|
||||
use gpui::*;
|
||||
use gpui_component::{
|
||||
Disableable, Icon, Sizable, Size,
|
||||
ActiveTheme, Disableable, Icon, Sizable, Size,
|
||||
button::{Button, ButtonCustomVariant, ButtonVariants},
|
||||
h_flex,
|
||||
};
|
||||
@@ -100,12 +101,15 @@ impl RenderOnce for PFButton {
|
||||
fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement {
|
||||
let text = self.text;
|
||||
|
||||
let mut btn = Button::new(self.id).custom(
|
||||
ButtonCustomVariant::new(cx)
|
||||
.color(self.bg_color_start.into())
|
||||
.hover(self.bg_color_hover.into())
|
||||
.active(self.bg_color_active.into()),
|
||||
);
|
||||
let mut btn = Button::new(self.id)
|
||||
.custom(
|
||||
ButtonCustomVariant::new(cx)
|
||||
.color(self.bg_color_start.into())
|
||||
.hover(self.bg_color_hover.into())
|
||||
.active(self.bg_color_active.into())
|
||||
.border(cx.theme().border),
|
||||
)
|
||||
.border_t_1();
|
||||
|
||||
if self.width_full {
|
||||
btn = btn.w_full();
|
||||
@@ -209,12 +213,15 @@ impl RenderOnce for PFIconButton {
|
||||
let text = self.text;
|
||||
let icon = self.icon;
|
||||
|
||||
let mut btn = Button::new("pf-icon-btn").custom(
|
||||
ButtonCustomVariant::new(cx)
|
||||
.color(self.bg_color_start.into())
|
||||
.hover(self.bg_color_hover.into())
|
||||
.active(self.bg_color_active.into()),
|
||||
);
|
||||
let mut btn = Button::new("pf-icon-btn")
|
||||
.custom(
|
||||
ButtonCustomVariant::new(cx)
|
||||
.color(self.bg_color_start.into())
|
||||
.hover(self.bg_color_hover.into())
|
||||
.active(self.bg_color_active.into())
|
||||
.border(cx.theme().border),
|
||||
)
|
||||
.border_t_1();
|
||||
|
||||
if self.width_full {
|
||||
btn = btn.w_full();
|
||||
|
||||
@@ -309,12 +309,6 @@ impl ConfigView {
|
||||
let method = status.method.clone();
|
||||
|
||||
self._task = Some(cx.spawn(async move |_, cx| {
|
||||
use std::time::Duration;
|
||||
|
||||
cx.background_executor()
|
||||
.timer(Duration::from_millis(500))
|
||||
.await;
|
||||
|
||||
let result = io::write_config(changes, method, None);
|
||||
|
||||
let _ = entity.update(cx, |this, cx| {
|
||||
|
||||
Reference in New Issue
Block a user