Sha256: a6b3c93882abee88c7e524924e3e6f44b86203bb9a4a279b61a04deb66c66165

Contents?: true

Size: 1.54 KB

Versions: 140

Compression:

Stored size: 1.54 KB

Contents

# frozen_string_literal: true

module Primer
  module Alpha
    class Overlay
      DEFAULT_ALIGN_CONTENT = :end
      ALIGN_CONTENT_MAPPINGS = {
        :start => "Overlay-footer--alignStart",
        :center => "Overlay-footer--alignCenter",
        DEFAULT_ALIGN_CONTENT => "Overlay-footer--alignEnd"
      }.freeze
      ALIGN_CONTENT_OPTIONS = ALIGN_CONTENT_MAPPINGS.keys

      # A `Overlay::Footer` is a compositional component, used to render the
      # Footer of an overlay. See <%= link_to_component(Primer::Alpha::Overlay) %>.
      class Footer < Primer::Component
        # @param show_divider [Boolean] Show a divider between the footer and body.
        # @param align_content [Symbol] The alginment of contents. <%= one_of(Primer::Alpha::Overlay::ALIGN_CONTENT_OPTIONS) %>
        # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
        def initialize(
          show_divider: false,
          align_content: DEFAULT_ALIGN_CONTENT,
          **system_arguments
        )
          @system_arguments = deny_tag_argument(**system_arguments)
          @system_arguments[:tag] = :div
          @system_arguments[:classes] = class_names(
            "Overlay-footer",
            ALIGN_CONTENT_MAPPINGS[fetch_or_fallback(ALIGN_CONTENT_OPTIONS, align_content, DEFAULT_ALIGN_CONTENT)],
            { "Overlay-footer--divided": show_divider },
            system_arguments[:classes]
          )
        end

        def call
          render(Primer::BaseComponent.new(**@system_arguments)) { content }
        end
      end
    end
  end
end

Version data entries

140 entries across 140 versions & 2 rubygems

Version Path
primer_view_components-0.14.0 app/components/primer/alpha/overlay/footer.rb
openproject-primer_view_components-0.16.0 app/components/primer/alpha/overlay/footer.rb
openproject-primer_view_components-0.15.0 app/components/primer/alpha/overlay/footer.rb
openproject-primer_view_components-0.14.0 app/components/primer/alpha/overlay/footer.rb
openproject-primer_view_components-0.13.1 app/components/primer/alpha/overlay/footer.rb
primer_view_components-0.13.2 app/components/primer/alpha/overlay/footer.rb
primer_view_components-0.13.1 app/components/primer/alpha/overlay/footer.rb
openproject-primer_view_components-0.13.0 app/components/primer/alpha/overlay/footer.rb
primer_view_components-0.13.0 app/components/primer/alpha/overlay/footer.rb
primer_view_components-0.12.0 app/components/primer/alpha/overlay/footer.rb
primer_view_components-0.11.0 app/components/primer/alpha/overlay/footer.rb
openproject-primer_view_components-0.12.1 app/components/primer/alpha/overlay/footer.rb
primer_view_components-0.10.0 app/components/primer/alpha/overlay/footer.rb
openproject-primer_view_components-0.11.0 app/components/primer/alpha/overlay/footer.rb
openproject-primer_view_components-0.10.0 app/components/primer/alpha/overlay/footer.rb
primer_view_components-0.9.0 app/components/primer/alpha/overlay/footer.rb
openproject-primer_view_components-0.9.1 app/components/primer/alpha/overlay/footer.rb
openproject-primer_view_components-0.9.0 app/components/primer/alpha/overlay/footer.rb
openproject-primer_view_components-0.8.0 app/components/primer/alpha/overlay/footer.rb
primer_view_components-0.8.0 app/components/primer/alpha/overlay/footer.rb