Module: Klods::Components::Card

Included in:
Builders
Defined in:
lib/klods/components/card.rb

Instance Method Summary collapse

Instance Method Details

#card(a = nil, b = nil, &block) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/klods/components/card.rb', line 4

def card(a = nil, b = nil, &block)
  props, children = Core.normalize_args(a, b)
  children = klods_capture(&block) if block
  Core.build(
    tag: "div", base: "klods-card",
    modifiers: {elevated: "klods-card--elevated"},
    props: props, children: children
  )
end

#card_body(a = nil, b = nil, &block) ⇒ Object



20
21
22
23
24
# File 'lib/klods/components/card.rb', line 20

def card_body(a = nil, b = nil, &block)
  props, children = Core.normalize_args(a, b)
  children = klods_capture(&block) if block
  Core.build(tag: "div", base: "klods-card__body", props: props, children: children)
end


26
27
28
29
30
# File 'lib/klods/components/card.rb', line 26

def card_footer(a = nil, b = nil, &block)
  props, children = Core.normalize_args(a, b)
  children = klods_capture(&block) if block
  Core.build(tag: "div", base: "klods-card__footer", props: props, children: children)
end

#card_title(a = nil, b = nil, &block) ⇒ Object



14
15
16
17
18
# File 'lib/klods/components/card.rb', line 14

def card_title(a = nil, b = nil, &block)
  props, children = Core.normalize_args(a, b)
  children = klods_capture(&block) if block
  Core.build(tag: "h3", base: "klods-card__title", props: props, children: children)
end