Class: Www::FloorplanCategoryComponent

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

Overview

ViewComponent: renders the floorplan category 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(section_title:, rooms:, description: nil, view_more_title: nil, view_more_href: nil, col_size: 'col-6 col-lg-4 col-xl-3 mb-4 d-flex', link_prefix: nil, mode: :floor_heating, show_smartplan_cta: true) ⇒ FloorplanCategoryComponent

Returns a new instance of FloorplanCategoryComponent.

Parameters:

  • section_title (String)

    heading shown above the room cards

  • rooms (Array<Hash, Symbol, String>)

    rooms to render; symbols/strings are
    expanded through ROOM_CONFIGS

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

    optional paragraph rendered under the heading

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

    label for the optional "view more" link

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

    URL for the optional "view more" link

  • col_size (String) (defaults to: 'col-6 col-lg-4 col-xl-3 mb-4 d-flex')

    Bootstrap column classes applied to each room card

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

    path prefix prepended to each room's slug to
    build its link

  • mode (Symbol, nil) (defaults to: :floor_heating)

    :floor_heating or :snow_melting; controls filtering
    and the CTA variant

  • show_smartplan_cta (Boolean) (defaults to: true)

    whether to render the SmartPlan call to action



17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/components/www/floorplan_category_component.rb', line 17

def initialize(section_title:, rooms:, description: nil, view_more_title: nil, view_more_href: nil, col_size: 'col-6 col-lg-4 col-xl-3 mb-4 d-flex', link_prefix: nil, mode: :floor_heating, show_smartplan_cta: true)
  super()
  @section_title = section_title
  @rooms = rooms
  @description = description
  @view_more_title = view_more_title
  @view_more_href = view_more_href
  @col_size = col_size
  @link_prefix = link_prefix
  @mode = (mode || :floor_heating).to_sym
  @show_smartplan_cta = show_smartplan_cta
end