Class: Panda::Core::Admin::HeadingComponent

Inherits:
Base
  • Object
show all
Defined in:
app/components/panda/core/admin/heading_component.rb

Constant Summary

Constants inherited from Base

Base::TAILWIND_MERGER

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text: "", icon: "", meta: nil, level: 2, additional_styles: nil, **attrs) {|_self| ... } ⇒ HeadingComponent

Returns a new instance of HeadingComponent.

Yields:

  • (_self)

Yield Parameters:



10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/components/panda/core/admin/heading_component.rb', line 10

def initialize(text: "", icon: "", meta: nil, level: 2, additional_styles: nil, **attrs, &block)
  @text = text
  @icon = icon
  @meta = meta
  @level = level
  @additional_styles = additional_styles
  super(**attrs)
  # Execute block if passed to new() directly (for tests/direct instantiation)
  # This allows: HeadingComponent.new(text: "Pages") { |h| h.with_button(...) }
  # Note: When used via render() with a block, ViewComponent handles the block separately
  yield self if block_given?
end

Instance Attribute Details

#iconObject (readonly)

Returns the value of attribute icon.



23
24
25
# File 'app/components/panda/core/admin/heading_component.rb', line 23

def icon
  @icon
end

#levelObject (readonly)

Returns the value of attribute level.



23
24
25
# File 'app/components/panda/core/admin/heading_component.rb', line 23

def level
  @level
end

#metaObject (readonly)

Returns the value of attribute meta.



23
24
25
# File 'app/components/panda/core/admin/heading_component.rb', line 23

def meta
  @meta
end

#textObject (readonly)

Returns the value of attribute text.



23
24
25
# File 'app/components/panda/core/admin/heading_component.rb', line 23

def text
  @text
end