Sha256: a903fbcdda874b815b62a410ad99f8d013efcc8ed2ffc22cc32be247fe207c68

Contents?: true

Size: 995 Bytes

Versions: 6

Compression:

Stored size: 995 Bytes

Contents

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

          attr_accessor :text, :level, :color, :position, :inline, :markdown

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

          def icon(icon=nil, **attribs, &block)
            return @icon if locked?
            @icon = Components::Icon.new(parent: self, icon: icon,
                                         **attribs, &block)
          end

        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
voom-presenters-2.1.2 lib/voom/presenters/dsl/components/typography.rb
voom-presenters-2.1.0 lib/voom/presenters/dsl/components/typography.rb
voom-presenters-2.0.3 lib/voom/presenters/dsl/components/typography.rb
voom-presenters-2.0.2 lib/voom/presenters/dsl/components/typography.rb
voom-presenters-2.0.1 lib/voom/presenters/dsl/components/typography.rb
voom-presenters-2.0.0 lib/voom/presenters/dsl/components/typography.rb