Make border
methods always require an explicit width (#11450)
This PR makes the `border` methods require an explicit width instead of defaulting to 1px. This breaks convention with Tailwind, but it makes GPUI more consistent with itself. We already have an edge case where the parameterized method had to be named `border_width`, since `border` was taken up by an alias for the 1px variant. ### Before ```rs div() .border() .border_t() .border_r() .border_b() .border_l() .border_width(px(7.)) ``` ### After ```rs div() .border_1() .border_t_1() .border_r_1() .border_b_1() .border_l_1() .border(px(7.)) ``` Release Notes: - N/A
This commit is contained in:
parent
f99b24acca
commit
f658af5903
24 changed files with 49 additions and 55 deletions
|
@ -86,12 +86,7 @@ fn generate_methods() -> Vec<TokenStream2> {
|
|||
|
||||
for (prefix, fields, prefix_doc_string) in border_prefixes() {
|
||||
methods.push(generate_custom_value_setter(
|
||||
// The plain method names (e.g., `border`, `border_t`, `border_r`, etc.) are special-cased
|
||||
// versions of the 1px variants. This better matches Tailwind, but breaks our existing
|
||||
// convention of the suffix-less variant of the method being the one that accepts a custom value
|
||||
//
|
||||
// To work around this, we're assigning a `_width` suffix here.
|
||||
&format!("{prefix}_width"),
|
||||
prefix,
|
||||
quote! { AbsoluteLength },
|
||||
&fields,
|
||||
prefix_doc_string,
|
||||
|
@ -553,7 +548,6 @@ fn border_prefixes() -> Vec<(&'static str, Vec<TokenStream2>, &'static str)> {
|
|||
|
||||
fn border_suffixes() -> Vec<(&'static str, TokenStream2, &'static str)> {
|
||||
vec![
|
||||
("", quote! { px(1.)}, "1px"),
|
||||
("0", quote! { px(0.)}, "0px"),
|
||||
("1", quote! { px(1.) }, "1px"),
|
||||
("2", quote! { px(2.) }, "2px"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue