Sha256: 8d66588f434d9b9858796243800e933e5a5fe4a2b751ab53eabe5951e2a393dd

Contents?: true

Size: 570 Bytes

Versions: 3

Compression:

Stored size: 570 Bytes

Contents

# frozen_string_literal: true

class Scarpe
  class WebviewFill < WebviewWidget
    def initialize(properties)
      super(properties)
    end

    def element
      width = @parent.get_style[:width]
      height = @parent.get_style[:height]

      HTML.render do |h|
        h.div(id: html_id, style: style(width, height)) do
          @text
        end
      end
    end

    private

    def style(width, height)
      styles = {}
      styles[:width] = width
      styles[:height] = height
      styles[:background] = @color if @color
      styles
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
lacci-0.2.1 lib/scarpe/wv/fill.rb
scarpe-0.2.1 lib/scarpe/wv/fill.rb
scarpe-0.2.0 lib/scarpe/wv/fill.rb