Sha256: 05680e427df1b9ffb00cd52b5d72cd2aa2b8b9ead7555990870f7af7c2698b05

Contents?: true

Size: 428 Bytes

Versions: 3

Compression:

Stored size: 428 Bytes

Contents

module Lookbook
  class Icon::Component < Lookbook::Component
    def initialize(name:, size: 4, **html_attrs)
      @icon_name = name.is_a?(Symbol) ? name.to_s.tr("_", "-").to_json : name
      @size = size || 4
      super(**html_attrs)
    end

    def size_rems
      "#{@size * 0.25}rem"
    end

    protected

    def alpine_data
      @icon_name
    end

    def alpine_component
      "iconComponent"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lookbook-1.0.0.beta.2 app/components/lookbook/icon/component.rb
lookbook-1.0.0.beta.1 app/components/lookbook/icon/component.rb
lookbook-1.0.0.beta.0 app/components/lookbook/icon/component.rb