Sha256: 6ad2b03990445046d63ab39c299481022b13c9ce07d30f23818b34369813e420

Contents?: true

Size: 996 Bytes

Versions: 12

Compression:

Stored size: 996 Bytes

Contents

module Coprl
  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

12 entries across 12 versions & 1 rubygems

Version Path
coprl-3.0.0.beta.12 lib/coprl/presenters/dsl/components/typography.rb
coprl-3.0.0.beta.11 lib/coprl/presenters/dsl/components/typography.rb
coprl-3.0.0.beta.10 lib/coprl/presenters/dsl/components/typography.rb
coprl-3.0.0.beta.9 lib/coprl/presenters/dsl/components/typography.rb
coprl-3.0.0.beta.8 lib/coprl/presenters/dsl/components/typography.rb
coprl-3.0.0.beta.7 lib/coprl/presenters/dsl/components/typography.rb
coprl-3.0.0.beta.6 lib/coprl/presenters/dsl/components/typography.rb
coprl-3.0.0.beta.5 lib/coprl/presenters/dsl/components/typography.rb
coprl-3.0.0.beta.4 lib/coprl/presenters/dsl/components/typography.rb
coprl-3.0.0.beta.3 lib/coprl/presenters/dsl/components/typography.rb
coprl-3.0.0.beta.2 lib/coprl/presenters/dsl/components/typography.rb
coprl-3.0.0.beta.1 lib/coprl/presenters/dsl/components/typography.rb