Class: Spark::Block
- Inherits:
-
Component::Base
- Object
- ActionView::Component::Base
- Component::Base
- Spark::Block
- Defined in:
- app/components/spark/block.rb
Direct Known Subclasses
Constant Summary collapse
- GUTTER =
%i[small base medium large xl].freeze
- LAYOUT =
%i[flush padded].freeze
- SPACER_SIZE =
%i[base].freeze
Instance Method Summary collapse
-
#content_only? ⇒ Boolean
When direct content is passed but no item or action elements are used.
-
#initialize ⇒ Block
constructor
A new instance of Block.
Methods inherited from Component::Base
Constructor Details
#initialize ⇒ Block
Returns a new instance of Block.
53 54 55 56 57 58 59 60 61 62 |
# File 'app/components/spark/block.rb', line 53 def initialize(*) super classname.base = "spark-block" classname.add("gutter-#{@gutter}") classname.add("action-gutter-#{@action_gutter}") classname.add("flex-no-wrap") unless @wrap classname.add("layout-#{@layout}") tag_attrs.add(role: @role) end |
Instance Method Details
#content_only? ⇒ Boolean
When direct content is passed but no item or action elements are used
65 66 67 |
# File 'app/components/spark/block.rb', line 65 def content_only? items.empty? && actions.empty? && @content.present? end |