Skip to content

Commit

Permalink
Support font_size and border_radius in classify/utilities (#2447)
Browse files Browse the repository at this point in the history
Co-authored-by: Jon Rohan <rohan@github.com>
Co-authored-by: Cameron Dutro <camertron@gmail.com>
  • Loading branch information
3 people committed Dec 15, 2023
1 parent da60c73 commit 08a8e01
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/four-shoes-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/view-components": minor
---

Support font_size and border_radius in classify/utilities
4 changes: 3 additions & 1 deletion lib/primer/classify/utilities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ class Utilities
"^height" => "h",
"^color-bg" => "bg",
"^color-border" => "border_color",
"^color-fg" => "color"
"^color-fg" => "color",
"^f" => "font_size",
"^rounded" => "border_radius"
}.freeze

SUPPORTED_KEY_CACHE = Hash.new { |h, k| h[k] = !UTILITIES[k].nil? }
Expand Down
1 change: 1 addition & 0 deletions test/lib/classify/utilities_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def test_classes_to_args
assert_equal('mr: 1, mb: 2, classes: "foo"', Primer::Classify::Utilities.classes_to_args("mr-1 mb-2 foo"))
assert_equal('classes: "foo"', Primer::Classify::Utilities.classes_to_args("foo"))
assert_equal("mx: :auto", Primer::Classify::Utilities.classes_to_args("mx-auto"))
assert_equal("font_size: 3, border_radius: 0", Primer::Classify::Utilities.classes_to_args("f3 rounded-0"))
assert_equal('mr: [1, 2], classes: "baz bin"', Primer::Classify::Utilities.classes_to_args("mr-1 mr-sm-2 baz bin"))
assert_equal('mr: [1, nil, 2], classes: "foo bar"', Primer::Classify::Utilities.classes_to_args("mr-1 mr-md-2 foo bar"))
end
Expand Down

0 comments on commit 08a8e01

Please sign in to comment.