Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

gpui: Add `align-self` methods to `Styled` trait (#51652)

Sebastian Kootzfa7182b6bac3
diff --git a/crates/gpui/src/styled.rs b/crates/gpui/src/styled.rs
index f83e9103572..bc394271585 100644
--- a/crates/gpui/src/styled.rs
+++ b/crates/gpui/src/styled.rs
@@ -1,5 +1,5 @@
use crate::{
- self as gpui, AbsoluteLength, AlignContent, AlignItems, BorderStyle, CursorStyle,
+ self as gpui, AbsoluteLength, AlignContent, AlignItems, AlignSelf, BorderStyle, CursorStyle,
DefiniteLength, Display, Fill, FlexDirection, FlexWrap, Font, FontFeatures, FontStyle,
FontWeight, GridPlacement, Hsla, JustifyContent, Length, SharedString, StrikethroughStyle,
StyleRefinement, TextAlign, TextOverflow, TextStyleRefinement, UnderlineStyle, WhiteSpace, px,
@@ -278,6 +278,55 @@ pub trait Styled: Sized {
self
}
+ /// Sets how this specific element is aligned along the container's cross axis.
+ /// [Docs](https://tailwindcss.com/docs/align-self#start)
+ fn self_start(mut self) -> Self {
+ self.style().align_self = Some(AlignSelf::Start);
+ self
+ }
+
+ /// Sets this element to align against the end of the container's cross axis.
+ /// [Docs](https://tailwindcss.com/docs/align-self#end)
+ fn self_end(mut self) -> Self {
+ self.style().align_self = Some(AlignSelf::End);
+ self
+ }
+
+ /// Sets this element to align against the start of the container's cross axis.
+ /// [Docs](https://tailwindcss.com/docs/align-self#start)
+ fn self_flex_start(mut self) -> Self {
+ self.style().align_self = Some(AlignSelf::FlexStart);
+ self
+ }
+
+ /// Sets this element to align against the end of the container's cross axis.
+ /// [Docs](https://tailwindcss.com/docs/align-self#end)
+ fn self_flex_end(mut self) -> Self {
+ self.style().align_self = Some(AlignSelf::FlexEnd);
+ self
+ }
+
+ /// Sets this element to align along the center of the container's cross axis.
+ /// [Docs](https://tailwindcss.com/docs/align-self#center)
+ fn self_center(mut self) -> Self {
+ self.style().align_self = Some(AlignSelf::Center);
+ self
+ }
+
+ /// Sets this element to align along the baseline of the container's cross axis.
+ /// [Docs](https://tailwindcss.com/docs/align-self#baseline)
+ fn self_baseline(mut self) -> Self {
+ self.style().align_self = Some(AlignSelf::Baseline);
+ self
+ }
+
+ /// Sets this element to stretch to fill the available space along the container's cross axis.
+ /// [Docs](https://tailwindcss.com/docs/align-self#stretch)
+ fn self_stretch(mut self) -> Self {
+ self.style().align_self = Some(AlignSelf::Stretch);
+ self
+ }
+
/// Sets the element to justify flex items against the start of the container's main axis.
/// [Docs](https://tailwindcss.com/docs/justify-content#start)
fn justify_start(mut self) -> Self {