Class: Www::ProductShowcaseComponent
- Inherits:
-
ApplicationComponent
- Object
- ViewComponent::Base
- ApplicationComponent
- Www::ProductShowcaseComponent
- 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
Usage:
<%# 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
-
#initialize(showcase:, product_name: nil) ⇒ ProductShowcaseComponent
constructor
A new instance of ProductShowcaseComponent.
-
#render? ⇒ Boolean
Whether the showcase has enough data to render.
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.
27 28 29 30 31 |
# File 'app/components/www/product_showcase_component.rb', line 27 def initialize(showcase:, product_name: nil) super() @showcase = showcase @product_name = product_name end |
Instance Method Details
#render? ⇒ Boolean
Returns whether the showcase has enough data to render.
34 35 36 |
# File 'app/components/www/product_showcase_component.rb', line 34 def render? showcase.present? && showcase.main_image.present? end |