Class: Www::SectionHeaderComponent
- Inherits:
-
ApplicationComponent
- Object
- ViewComponent::Base
- ApplicationComponent
- Www::SectionHeaderComponent
- Includes:
- ActionView::Helpers::TagHelper
- Defined in:
- app/components/www/section_header_component.rb
Overview
SectionHeaderComponent - Renders a consistent section header with optional icon and description
Used by various components to provide a consistent header style.
The border (hr) is optional and defaults to false since PageSectionComponent now handles section borders.
Instance Method Summary collapse
-
#initialize(title:, icon: nil, svg_icon: nil, description: nil, border: false, hr_classes: 'mt-2 mb-4') ⇒ SectionHeaderComponent
constructor
A new instance of SectionHeaderComponent.
- #render_border? ⇒ Boolean
-
#svg_icon? ⇒ Boolean
Returns true if using custom SVG icon.
-
#svg_icon_path ⇒ Object
Full path for inline_svg_tag.
Methods inherited from ApplicationComponent
#cms_link, #fetch_or_fallback, #image_asset_tag, #image_tag, #number_to_currency, #number_with_delimiter, #post_path, #post_url, #strip_tags
Constructor Details
#initialize(title:, icon: nil, svg_icon: nil, description: nil, border: false, hr_classes: 'mt-2 mb-4') ⇒ SectionHeaderComponent
Returns a new instance of SectionHeaderComponent.
30 31 32 33 34 35 36 37 38 |
# File 'app/components/www/section_header_component.rb', line 30 def initialize(title:, icon: nil, svg_icon: nil, description: nil, border: false, hr_classes: 'mt-2 mb-4') super() @title = title @icon = icon @svg_icon = svg_icon @description = description @border = border @hr_classes = hr_classes end |
Instance Method Details
#render_border? ⇒ Boolean
50 51 52 |
# File 'app/components/www/section_header_component.rb', line 50 def render_border? @border end |
#svg_icon? ⇒ Boolean
Returns true if using custom SVG icon
41 42 43 |
# File 'app/components/www/section_header_component.rb', line 41 def svg_icon? @svg_icon.present? end |
#svg_icon_path ⇒ Object
Full path for inline_svg_tag
46 47 48 |
# File 'app/components/www/section_header_component.rb', line 46 def svg_icon_path "svgs/custom/#{@svg_icon}" end |