Class: NitroKit::Card
Instance Attribute Summary
Attributes inherited from Component
#attrs
Instance Method Summary
collapse
Methods inherited from Component
#builder, builder_method, from_template
Constructor Details
#initialize(**attrs) ⇒ Card
Returns a new instance of Card.
5
6
7
8
9
10
|
# File 'app/components/nitro_kit/card.rb', line 5
def initialize(**attrs)
super(
attrs,
class: base_class
)
end
|
Instance Method Details
#body(text = nil, **attrs, &block) ⇒ Object
26
27
28
29
30
31
32
|
# File 'app/components/nitro_kit/card.rb', line 26
def body(text = nil, **attrs, &block)
builder do
div(**mattr(attrs, class: "text-muted-content text-sm leading-relaxed")) do
text_or_block(text, &block)
end
end
end
|
#divider(**attrs) ⇒ Object
42
43
44
45
46
47
48
|
# File 'app/components/nitro_kit/card.rb', line 42
def divider(**attrs)
builder do
full_width do
hr(**attrs)
end
end
end
|
34
35
36
37
38
39
40
|
# File 'app/components/nitro_kit/card.rb', line 34
def (text = nil, **attrs, &block)
builder do
div(**mattr(attrs, class: "flex gap-2 items-center")) do
text_or_block(text, &block)
end
end
end
|
#full_width(**attrs) ⇒ Object
50
51
52
53
54
55
56
|
# File 'app/components/nitro_kit/card.rb', line 50
def full_width(**attrs)
builder do
div(**mattr(attrs, data: { slot: "full" }, class: "-mx-(--gap)")) do
yield
end
end
end
|
#title(text = nil, **attrs, &block) ⇒ Object
18
19
20
21
22
23
24
|
# File 'app/components/nitro_kit/card.rb', line 18
def title(text = nil, **attrs, &block)
builder do
h2(**mattr(attrs, class: "text-lg font-bold -mb-2")) do
text_or_block(text, &block)
end
end
end
|
#view_template ⇒ Object
12
13
14
15
16
|
# File 'app/components/nitro_kit/card.rb', line 12
def view_template
div(**attrs) do
yield
end
end
|