some more bs

This commit is contained in:
2026-04-21 11:50:04 +01:00
parent 74a01bd9e6
commit 6c60013295
11 changed files with 177 additions and 58 deletions

35
src/component/button.rs Normal file
View File

@@ -0,0 +1,35 @@
use gpui::{FontWeight, InteractiveElement, ParentElement, Styled, div};
use crate::{app, component::text::Text};
pub struct Button(gpui::Stateful<gpui::Div>);
pub fn button<T>(id: impl Into<gpui::ElementId>, cx: &gpui::Context<T>) -> Button {
let theme = app::current_theme(cx);
Button(
div()
.id(id)
.rounded_sm()
.bg(theme.colors.accent)
.text_xs()
.text_color(theme.colors.accent_text)
.font_weight(FontWeight(500.))
.px_2p5()
.py_0p5(),
)
}
impl Button {
pub fn label(mut self, s: impl Text) -> Self {
self.0 = self.0.child(s);
self
}
}
impl gpui::IntoElement for Button {
type Element = gpui::Stateful<gpui::Div>;
fn into_element(self) -> Self::Element {
self.0
}
}