Sha256: 665faa0e68d3f5af91a23d676ec1c9ab0561d884e56cd47726c6fc889feaad46

Contents?: true

Size: 994 Bytes

Versions: 5

Compression:

Stored size: 994 Bytes

Contents

require_relative 'mixins/event'
require_relative 'mixins/tooltips'

module Voom
  module Presenters
    module DSL
      module Components
        class Typography < EventBase
          include Mixins::Tooltips

          attr_accessor :text, :level, :color, :position

          def initialize(parent:, **attribs_, &block)
            super(type: :text, parent: parent, **attribs_, &block)
            @text = Array(attribs.delete(:text)||'').flatten.join("\n\n").split("\n\n")
            @level = attribs.delete(:level){1}
            @color = attribs.delete(:color)
            @position = Array(attribs.delete(:position)).compact
            expand!
          end

          def icon(icon=nil, **attribs, &block)
            return @icon if locked?
            @icon = Components::Icon.new(parent: self, icon: icon,
                                         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/typography.rb
voom-presenters-0.1.12 lib/voom/presenters/dsl/components/typography.rb
voom-presenters-0.1.11 lib/voom/presenters/dsl/components/typography.rb
voom-presenters-0.1.10 lib/voom/presenters/dsl/components/typography.rb
voom-presenters-0.1.9 lib/voom/presenters/dsl/components/typography.rb