Class: Www::CardGridComponent

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

Constant Summary collapse

DEFAULT_ICONS =

Default icons for different content types

{
  documents: 'file-lines',
  blog: 'newspaper',
  mixed: 'folder-open'
}.freeze

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(col_size: 'col-6 col-sm-6 col-md-3 col-xxl-2 mt-4', document_cards: [], blog_post_ids: [], section_title: nil, section_description: nil, section_icon: nil, publications: [], posts: [], row_cols_classes: 'row row-cols-2 row-cols-sm-2 row-cols-md-3 row-cols-lg-4 row-cols-xxl-6 g-4', border: nil) ⇒ CardGridComponent

Returns a new instance of CardGridComponent.

Parameters:

  • border (Symbol, nil) (defaults to: nil)

    Border style: :top, :bottom, or :both

  • col_size (String) (defaults to: 'col-6 col-sm-6 col-md-3 col-xxl-2 mt-4')
  • document_cards (Array<Object>) (defaults to: [])
  • blog_post_ids (Array<Object>) (defaults to: [])
  • section_title (Object, nil) (defaults to: nil)
  • section_description (String, nil) (defaults to: nil)

    Optional description below title

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

    Font Awesome icon name (auto-detected if nil)

  • publications (Array<Object>) (defaults to: [])
  • posts (Array<Object>) (defaults to: [])
  • row_cols_classes (String) (defaults to: 'row row-cols-2 row-cols-sm-2 row-cols-md-3 row-cols-lg-4 row-cols-xxl-6 g-4')


21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/components/www/card_grid_component.rb', line 21

def initialize(col_size: 'col-6 col-sm-6 col-md-3 col-xxl-2 mt-4', document_cards: [], blog_post_ids: [], section_title: nil, section_description: nil, section_icon: nil, publications: [], posts: [],
               row_cols_classes: 'row row-cols-2 row-cols-sm-2 row-cols-md-3 row-cols-lg-4 row-cols-xxl-6 g-4', border: nil)
  super()
  @col_size = col_size
  @document_cards = document_cards
  @blog_post_ids = blog_post_ids
  @section_title = section_title
  @section_description = section_description
  @section_icon_override = section_icon
  @publications = publications
  @posts = posts
  @row_cols_classes = row_cols_classes
  @border = border
end