Sha256: 98156415fdeb53c5cef38371bd0b4f03a47aef887c3974a3d046e8488e41305b

Contents?: true

Size: 930 Bytes

Versions: 8

Compression:

Stored size: 930 Bytes

Contents

module Voom
  module Presenters
    module DSL
      module Components
        class Header < Base
          attr_accessor :title, :image

          def initialize(**attribs_, &block)
            super(type: :header,
                  context: context,
                  **attribs_, &block)
            self.title(attribs.delete(:title)) if attribs.key?(:title)
            @image = attribs.delete(:image)
            expand!
          end

          def menu(**attribs, &block)
            return @menu if locked?
            @menu = Menu.new(parent: self,
                             context: context,
                             **attribs, &block)
          end

          def title(*text, **attribs, &block)
            return @title if locked?
            @title = Components::Typography.new(parent: self, type: :text, text: text, context: context, **attribs, &block)
          end

        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
voom-presenters-0.1.7 lib/voom/presenters/dsl/components/header.rb
voom-presenters-0.1.6 lib/voom/presenters/dsl/components/header.rb
voom-presenters-0.1.5 lib/voom/presenters/dsl/components/header.rb
voom-presenters-0.1.4 lib/voom/presenters/dsl/components/header.rb
voom-presenters-0.1.3 lib/voom/presenters/dsl/components/header.rb
voom-presenters-0.1.2 lib/voom/presenters/dsl/components/header.rb
voom-presenters-0.1.1 lib/voom/presenters/dsl/components/header.rb
voom-presenters-0.1.0 lib/voom/presenters/dsl/components/header.rb