class Voom::Presenters::DSL::Components::Card::Media

Attributes

color[R]
components[R]
height[R]
hidden[R]
width[R]

Public Class Methods

new(**attribs_, &block) click to toggle source
# File lib/voom/presenters/dsl/components/card.rb, line 54
def initialize(**attribs_, &block)
  super(type: :media, **attribs_, &block)
  @height = attribs.delete(:height)
  @width = attribs.delete(:width)
  @color = attribs.delete(:color)
  @hidden = attribs.delete(:hidden) {false}

  @components = []
  expand!
end

Public Instance Methods

avatar(avatar = nil, **attribs, &block) click to toggle source
# File lib/voom/presenters/dsl/components/card.rb, line 79
def avatar(avatar = nil, **attribs, &block)
  return @avatar if locked?
  @avatar = Avatar.new(parent: self, avatar: avatar,
                       **attribs, &block)
end
button(icon = nil, **attributes, &block) click to toggle source
# File lib/voom/presenters/dsl/components/card.rb, line 90
def button(icon = nil, **attributes, &block)
  return @button if locked?
  @button = Components::Button.new(icon: icon, position: [:top, :right], parent: self, **attributes, &block)
end
image(image = nil, **attribs, &block) click to toggle source
# File lib/voom/presenters/dsl/components/card.rb, line 85
def image(image = nil, **attribs, &block)
  return @image if locked?
  @image = Image.new(parent: self, image: image, **attribs, &block)
end
subtitle(*text, **attribs, &block) click to toggle source
# File lib/voom/presenters/dsl/components/card.rb, line 74
def subtitle(*text, **attribs, &block)
  return @subtitle if locked?
  @subtitle = Components::Typography.new(parent: self, type: :subtitle, text: text, **attribs, &block)
end
title(*title, **attribs, &block) click to toggle source
# File lib/voom/presenters/dsl/components/card.rb, line 65
def title(*title, **attribs, &block)
  return @title if locked?
  @title = Typography.new(type: :headline,
                          level: 6,
                          parent: self,
                          text: title,
                          **attribs, &block)
end