Class: Www::BlogFaqSectionComponent

Inherits:
ApplicationComponent show all
Defined in:
app/components/www/blog_faq_section_component.rb

Overview

Section wrapper for blog FAQs rendered via the faq % liquid tag.
Displays a section with title, icon, and list of FAQ cards.

Constant Summary collapse

DEFAULT_TITLE =
'Frequently Asked Questions'
DEFAULT_ICON =
'circle-question'

Instance Method Summary collapse

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(article_faqs:, section_title: nil, preview_mode: false) ⇒ BlogFaqSectionComponent

Returns a new instance of BlogFaqSectionComponent.

Parameters:

  • article_faqs (Array<Article>)

    FAQ article records to display

  • section_title (String, nil) (defaults to: nil)

    Optional custom title (defaults to "Frequently Asked Questions")

  • preview_mode (Boolean) (defaults to: false)

    Whether to render draft content



12
13
14
15
16
17
# File 'app/components/www/blog_faq_section_component.rb', line 12

def initialize(article_faqs:, section_title: nil, preview_mode: false)
  super()
  @article_faqs = Array(article_faqs).compact
  @section_title = section_title.presence || DEFAULT_TITLE
  @preview_mode = preview_mode
end

Instance Method Details

#render?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'app/components/www/blog_faq_section_component.rb', line 19

def render?
  @article_faqs.present?
end