Sha256: f3b21525870bb71614b4f39a857863cbd7e6bebf3c094c9ec9bf136b59220bc2

Contents?: true

Size: 655 Bytes

Versions: 123

Compression:

Stored size: 655 Bytes

Contents

module GovukPublishingComponents
  module Presenters
    class SharedHelper
      attr_reader :options, :margin_bottom, :heading_level

      def initialize(local_assigns)
        @options = local_assigns
        @margin_bottom = @options[:margin_bottom] || 3
        @heading_level = @options[:heading_level] || 2
      end

      def get_margin_bottom
        [*0..9].include?(@margin_bottom) ? "govuk-!-margin-bottom-#{margin_bottom}" : "govuk-!-margin-bottom-3"
      end

      def get_heading_level
        return [*1..6].include?(@heading_level) ? "h#{@heading_level}" : "h2" unless @heading_level.zero?

        "span"
      end
    end
  end
end

Version data entries

123 entries across 123 versions & 1 rubygems

Version Path
govuk_publishing_components-21.22.2 lib/govuk_publishing_components/presenters/shared_helper.rb
govuk_publishing_components-21.22.1 lib/govuk_publishing_components/presenters/shared_helper.rb
govuk_publishing_components-21.22.0 lib/govuk_publishing_components/presenters/shared_helper.rb
govuk_publishing_components-21.21.3 lib/govuk_publishing_components/presenters/shared_helper.rb
govuk_publishing_components-21.21.2 lib/govuk_publishing_components/presenters/shared_helper.rb
govuk_publishing_components-21.21.1 lib/govuk_publishing_components/presenters/shared_helper.rb
govuk_publishing_components-21.21.0 lib/govuk_publishing_components/presenters/shared_helper.rb
govuk_publishing_components-21.20.0 lib/govuk_publishing_components/presenters/shared_helper.rb
govuk_publishing_components-21.19.1 lib/govuk_publishing_components/presenters/shared_helper.rb
govuk_publishing_components-21.19.0 lib/govuk_publishing_components/presenters/shared_helper.rb
govuk_publishing_components-21.18.0 lib/govuk_publishing_components/presenters/shared_helper.rb
govuk_publishing_components-21.17.0 lib/govuk_publishing_components/presenters/shared_helper.rb
govuk_publishing_components-21.16.3 lib/govuk_publishing_components/presenters/shared_helper.rb
govuk_publishing_components-21.16.2 lib/govuk_publishing_components/presenters/shared_helper.rb
govuk_publishing_components-21.16.1 lib/govuk_publishing_components/presenters/shared_helper.rb
govuk_publishing_components-21.16.0 lib/govuk_publishing_components/presenters/shared_helper.rb
govuk_publishing_components-21.15.2 lib/govuk_publishing_components/presenters/shared_helper.rb
govuk_publishing_components-21.15.1 lib/govuk_publishing_components/presenters/shared_helper.rb
govuk_publishing_components-21.15.0 lib/govuk_publishing_components/presenters/shared_helper.rb
govuk_publishing_components-21.14.0 lib/govuk_publishing_components/presenters/shared_helper.rb