Sha256: a6b3c93882abee88c7e524924e3e6f44b86203bb9a4a279b61a04deb66c66165

Contents?: true

Size: 1.54 KB

Versions: 138

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

138 entries across 138 versions & 2 rubygems

Version Path
primer_view_components-0.36.5 app/components/primer/alpha/overlay/footer.rb
openproject-primer_view_components-0.52.2 app/components/primer/alpha/overlay/footer.rb
primer_view_components-0.36.4 app/components/primer/alpha/overlay/footer.rb
openproject-primer_view_components-0.52.1 app/components/primer/alpha/overlay/footer.rb
openproject-primer_view_components-0.52.0 app/components/primer/alpha/overlay/footer.rb
primer_view_components-0.36.3 app/components/primer/alpha/overlay/footer.rb
openproject-primer_view_components-0.51.0 app/components/primer/alpha/overlay/footer.rb
primer_view_components-0.36.2 app/components/primer/alpha/overlay/footer.rb
openproject-primer_view_components-0.50.1 app/components/primer/alpha/overlay/footer.rb
openproject-primer_view_components-0.50.0 app/components/primer/alpha/overlay/footer.rb
primer_view_components-0.36.1 app/components/primer/alpha/overlay/footer.rb
primer_view_components-0.36.0 app/components/primer/alpha/overlay/footer.rb
openproject-primer_view_components-0.49.2 app/components/primer/alpha/overlay/footer.rb
primer_view_components-0.35.2 app/components/primer/alpha/overlay/footer.rb
openproject-primer_view_components-0.49.1 app/components/primer/alpha/overlay/footer.rb
openproject-primer_view_components-0.49.0 app/components/primer/alpha/overlay/footer.rb
primer_view_components-0.35.1 app/components/primer/alpha/overlay/footer.rb
primer_view_components-0.35.0 app/components/primer/alpha/overlay/footer.rb
openproject-primer_view_components-0.48.2 app/components/primer/alpha/overlay/footer.rb
openproject-primer_view_components-0.48.1 app/components/primer/alpha/overlay/footer.rb