Sha256: cece08190bf7c167e090946c11229282cb2691ac8ee6f117823b96af75f531f0

Contents?: true

Size: 629 Bytes

Versions: 1

Compression:

Stored size: 629 Bytes

Contents

# frozen_string_literal: true

module Tramway
  module Helpers
    # ActionView helpers for tailwind
    #
    module TailwindHelpers
      def tailwind_link_to(text_or_url, url = nil, **options, &block)
        raise 'You can not provide argument and code block in the same time' if url.present? && block_given?

        if url.present?
          options.merge! href: url
          render(Tailwinds::Navbar::ButtonComponent.new(**options)) { text_or_url }
        else
          options.merge! href: text_or_url
          render(Tailwinds::Navbar::ButtonComponent.new(**options), &block)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tramway-0.1.4 lib/tramway/helpers/tailwind_helpers.rb