Sha256: b145385c9029714030e8b27eb964ee349ea060d97cfc00ff2ff46e1bb8cc54cd

Contents?: true

Size: 1.41 KB

Versions: 5

Compression:

Stored size: 1.41 KB

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 button(icon=nil, **attributes, &block)
            return @button if locked?
            @button = Components::Button.new(icon: icon, position:[:top, :right], parent: self, context: context, **attributes, &block)
          end

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

          def nav(**attribs, &block)
            return @nav if locked?
            @nav = Components::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

5 entries across 5 versions & 1 rubygems

Version Path
voom-presenters-0.1.13 lib/voom/presenters/dsl/components/header.rb
voom-presenters-0.1.12 lib/voom/presenters/dsl/components/header.rb
voom-presenters-0.1.11 lib/voom/presenters/dsl/components/header.rb
voom-presenters-0.1.10 lib/voom/presenters/dsl/components/header.rb
voom-presenters-0.1.9 lib/voom/presenters/dsl/components/header.rb