Sha256: a8c1c1ea5164d40c9ec4c8741ece0a8dc9647205616843a8ffe860ee6e4f1d94

Contents?: true

Size: 705 Bytes

Versions: 9

Compression:

Stored size: 705 Bytes

Contents

# frozen_string_literal: true

module Shoelace
  module TagHelper
    # Creates a generic +<sl-button>+ element.
    def sl_button_tag(**attrs, &block)
      content_tag("sl-button", **attrs, &block)
    end

    # Creates an <sl-button> tag with the href value as the caption.
    def sl_button_to(body, href = nil, **attrs, &block)
      if block_given?
        sl_button_tag(href: body, **(href || {}), **attrs, &block)
      else
        sl_button_tag(href: href, **attrs) { body }
      end
    end

    def sl_icon_tag(name, **attrs)
      tag.sl_icon(name: name, **attrs)
    end

    def sl_avatar_tag(source, **attrs, &block)
      tag.sl_avatar(image: source, **attrs, &block)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
shoelace-rails-0.8.0 app/helpers/shoelace/tag_helper.rb
shoelace-rails-0.7.0 app/helpers/shoelace/tag_helper.rb
shoelace-rails-0.6.2 app/helpers/shoelace/tag_helper.rb
shoelace-rails-0.6.1 app/helpers/shoelace/tag_helper.rb
shoelace-rails-0.6.0 app/helpers/shoelace/tag_helper.rb
shoelace-rails-0.5.0 app/helpers/shoelace/tag_helper.rb
shoelace-rails-0.4.1 app/helpers/shoelace/tag_helper.rb
shoelace-rails-0.4.0 app/helpers/shoelace/tag_helper.rb
shoelace-rails-0.3.0 app/helpers/shoelace/tag_helper.rb