Checkpoint: Add methods for setting arbitrary lengths

This commit is contained in:
Nathan Sobo 2023-09-18 19:48:22 -06:00
parent b725cadf48
commit a5e4ceb735
4 changed files with 90 additions and 39 deletions

View file

@ -314,6 +314,8 @@ pub trait Styleable {
}
}
use crate as gpui2;
// Helpers methods that take and return mut self. This includes tailwind style methods for standard sizes etc.
//
// Example:
@ -322,27 +324,6 @@ pub trait Styleable {
pub trait StyleHelpers: Styleable<Style = Style> {
styleable_helpers!();
fn h(mut self, height: Length) -> Self
where
Self: Sized,
{
self.declared_style().size.height = Some(height);
self
}
/// size_{n}: Sets width & height to {n}
///
/// Example:
/// size_1: Sets width & height to 1
fn size(mut self, size: Length) -> Self
where
Self: Sized,
{
self.declared_style().size.height = Some(size);
self.declared_style().size.width = Some(size);
self
}
fn full(mut self) -> Self
where
Self: Sized,