Class: Shadcn::CardContentComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/shadcn/card_content_component.rb

Overview

Card Content component

Constant Summary collapse

BASE_CLASSES =
"p-6"

Instance Attribute Summary

Attributes inherited from BaseComponent

#class_name, #data, #html_options

Instance Method Summary collapse

Methods inherited from BaseComponent

#content

Methods included from Rails::Helpers::ClassNameHelper

#cn

Constructor Details

#initialize(standalone: false, **options, &block) ⇒ CardContentComponent

Returns a new instance of CardContentComponent.

Parameters:

  • standalone (Boolean) (defaults to: false)

    Whether the content is standalone (no header above)



9
10
11
12
# File 'app/components/shadcn/card_content_component.rb', line 9

def initialize(standalone: false, **options, &block)
  super(**options, &block)
  @standalone = standalone
end

Instance Method Details

#callObject



14
15
16
17
# File 'app/components/shadcn/card_content_component.rb', line 14

def call
  classes = @standalone ? BASE_CLASSES : "#{BASE_CLASSES} pt-0"
  (:div, content, class: merge_classes(classes), **html_options)
end