Class: NitroKit::Card

Inherits:
Component
  • Object
show all
Defined in:
app/components/nitro_kit/card.rb

Instance Attribute Summary

Attributes inherited from Component

#attrs

Instance Method Summary collapse

Methods inherited from Component

#data_merge, merge, #merge

Constructor Details

#initialize(**attrs) ⇒ Card

Returns a new instance of Card.



3
4
5
# File 'app/components/nitro_kit/card.rb', line 3

def initialize(**attrs)
  @attrs = attrs
end

Instance Method Details

#body(**attrs) ⇒ Object



15
16
17
# File 'app/components/nitro_kit/card.rb', line 15

def body(**attrs)
  div(**attrs) { yield }
end


19
20
21
# File 'app/components/nitro_kit/card.rb', line 19

def footer(**attrs)
  div(**attrs, class: merge(["flex gap-2", attrs[:class]])) { yield }
end

#title(**attrs) ⇒ Object



11
12
13
# File 'app/components/nitro_kit/card.rb', line 11

def title(**attrs)
  h2(**attrs, class: merge(["text-lg font-bold", attrs[:class]])) { yield }
end

#view_template(&block) ⇒ Object



7
8
9
# File 'app/components/nitro_kit/card.rb', line 7

def view_template(&block)
  div(class: "rounded-lg border p-6 space-y-6 shadow-sm", &block)
end