Class: Www::ProductShowcaseComponent

Inherits:
ApplicationComponent show all
Includes:
ActionView::Helpers::TagHelper, ActionView::Helpers::UrlHelper
Defined in:
app/components/www/product_showcase_component.rb

Overview

ProductShowcaseComponent - Displays a showcase project on a product page

Designed to look good even with a single showcase, featuring:

  • Main image with overlay information
  • Location and room type badges
  • Optional operating cost display
  • Call-to-action to view full showcase

Examples:

Basic usage

<%= render Www::ProductShowcaseComponent.new(showcase: @showcase) %>

With product context

<%= render Www::ProductShowcaseComponent.new(
  showcase: @showcase,
  product_name: 'TempZone Cable'
) %>

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(showcase:, product_name: nil) ⇒ ProductShowcaseComponent

Returns a new instance of ProductShowcaseComponent.

Parameters:

  • showcase (Showcase)

    The showcase to display

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

    Optional product name for contextual messaging



26
27
28
29
30
# File 'app/components/www/product_showcase_component.rb', line 26

def initialize(showcase:, product_name: nil)
  super()
  @showcase = showcase
  @product_name = product_name
end

Instance Method Details

#render?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'app/components/www/product_showcase_component.rb', line 32

def render?
  showcase.present? && showcase.main_image.present?
end