Class: Www::TrainingCardComponent

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

Overview

ViewComponent: renders the training card block.

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(title:, description:, image_slug:, image_alt:, link_url:, link_text: 'Start Training') ⇒ TrainingCardComponent

Returns a new instance of TrainingCardComponent.

Parameters:

  • title (String)

    card heading text

  • description (String)

    card body copy

  • image_slug (String)

    slug identifying the card image

  • image_alt (String)

    alt text for the card image

  • link_url (String)

    destination URL for the call-to-action link

  • link_text (String) (defaults to: 'Start Training')

    label for the call-to-action link



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

def initialize(title:, description:, image_slug:, image_alt:, link_url:, link_text: 'Start Training')
  @title = title
  @description = description
  @image_slug = image_slug
  @image_alt = image_alt
  @link_url = link_url
  @link_text = link_text
end