Sha256: 8b6a1f2bfc511a3257dd3aa7ac9dc42f5f62f41ecb288cdf697dd9e491f834b3

Contents?: true

Size: 560 Bytes

Versions: 7

Compression:

Stored size: 560 Bytes

Contents

require 'tao_on_rails/components/base'

module TaoUi
  module Components
    class IconComponent < TaoOnRails::Components::Base

      attr_reader :name

      def initialize view, name, options = {}
        @name = name.to_s.dasherize
        super view, options
      end

      def render
        view.content_tag(:svg, %Q(<use xlink:href="#icon-#{name}"/>).html_safe, options)
      end

      def self.component_name
        :icon
      end

      private

      def default_options
        {class: ['icon', "icon-#{@name}"]}
      end

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
tao_ui-0.2.6 lib/tao_ui/components/icon_component.rb
tao_ui-0.2.5 lib/tao_ui/components/icon_component.rb
tao_ui-0.2.4 lib/tao_ui/components/icon_component.rb
tao_ui-0.2.3 lib/tao_ui/components/icon_component.rb
tao_ui-0.2.2 lib/tao_ui/components/icon_component.rb
tao_ui-0.2.1 lib/tao_ui/components/icon_component.rb
tao_ui-0.2.0 lib/tao_ui/components/icon_component.rb