some more bs
This commit is contained in:
35
src/component/button.rs
Normal file
35
src/component/button.rs
Normal 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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user