gpui_macros: Extract border_style_methods macro (#14514)

This PR extracts a separate `border_style_methods` macro so that it can
be used independently from `style_helpers!`.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-07-15 15:51:29 -04:00 committed by GitHub
parent fa3d29087d
commit 143035b1ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 59 additions and 37 deletions

View file

@ -5,8 +5,9 @@ use crate::{
SharedString, StyleRefinement, WhiteSpace,
};
pub use gpui_macros::{
box_shadow_style_methods, cursor_style_methods, margin_style_methods, overflow_style_methods,
padding_style_methods, position_style_methods, visibility_style_methods,
border_style_methods, box_shadow_style_methods, cursor_style_methods, margin_style_methods,
overflow_style_methods, padding_style_methods, position_style_methods,
visibility_style_methods,
};
use taffy::style::{AlignContent, Display};
@ -23,6 +24,7 @@ pub trait Styled: Sized {
gpui_macros::position_style_methods!();
gpui_macros::overflow_style_methods!();
gpui_macros::cursor_style_methods!();
gpui_macros::border_style_methods!();
gpui_macros::box_shadow_style_methods!();
/// Sets the display type of the element to `block`.
@ -303,16 +305,6 @@ pub trait Styled: Sized {
self
}
/// Sets the border color of the element.
fn border_color<C>(mut self, border_color: C) -> Self
where
C: Into<Hsla>,
Self: Sized,
{
self.style().border_color = Some(border_color.into());
self
}
/// Get the text style that has been configured on this element.
fn text_style(&mut self) -> &mut Option<TextStyleRefinement> {
let style: &mut StyleRefinement = self.style();