-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid specifying sidebar's icon fill color manually
With the default value of the icon_tag helper (fill-current) it's already inheriting from the parent color.
- Loading branch information
Showing
3 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# frozen_string_literal: true | ||
|
||
module SolidusAdmin | ||
module ComponentHelpers | ||
# Mocks a component class with the given definition. | ||
# | ||
# @param definition [Proc] the component definition | ||
# @example | ||
# mock_component do | ||
# def call | ||
# "Rendered" | ||
# end | ||
# end | ||
def mock_component(&definition) | ||
Class.new(SolidusAdmin::BaseComponent) do | ||
# ViewComponent will complain if we don't fake a class name: | ||
# @see https://github.com/ViewComponent/view_component/blob/5decd07842c48cbad82527daefa3fe9c65a4226a/lib/view_component/base.rb#L371 | ||
def self.name | ||
"Foo" | ||
end | ||
end.tap { |klass| klass.class_eval(&definition) } | ||
end | ||
end | ||
end |