Sha256: 817db7181c4fa9506d94ddaea870c84235ead9deee9ec5c1fe2fb51fc1164168

Contents?: true

Size: 1.15 KB

Versions: 69

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

module Primer
  module OpenProject
    # A layouting component used to arrange multiple components in a CSS Grid
    # Note that this component only provides helpers (as the class names and grid-area styles).
    # However, it does not define the actual Grid which should be done in a separate CSS-file.
    class GridLayout < Primer::Component
      status :open_project
      attr_reader :css_class

      renders_many :areas, lambda { |area_name, component = ::Primer::BaseComponent, **system_arguments, &block|
        render(Primer::OpenProject::GridLayout::Area.new(@css_class, area_name, component, **system_arguments), &block)
      }

      # @param css_class [String] The basic css class applied on the grid-container
      # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
      def initialize(css_class:, **system_arguments)
        super

        @system_arguments = system_arguments
        @css_class = css_class
        @system_arguments[:classes] = class_names(
          @system_arguments[:classes],
          css_class
        )
      end

      def render?
        areas.any?
      end
    end
  end
end

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
openproject-primer_view_components-0.52.2 app/components/primer/open_project/grid_layout.rb
openproject-primer_view_components-0.52.1 app/components/primer/open_project/grid_layout.rb
openproject-primer_view_components-0.52.0 app/components/primer/open_project/grid_layout.rb
openproject-primer_view_components-0.51.0 app/components/primer/open_project/grid_layout.rb
openproject-primer_view_components-0.50.1 app/components/primer/open_project/grid_layout.rb
openproject-primer_view_components-0.50.0 app/components/primer/open_project/grid_layout.rb
openproject-primer_view_components-0.49.2 app/components/primer/open_project/grid_layout.rb
openproject-primer_view_components-0.49.1 app/components/primer/open_project/grid_layout.rb
openproject-primer_view_components-0.49.0 app/components/primer/open_project/grid_layout.rb
openproject-primer_view_components-0.48.2 app/components/primer/open_project/grid_layout.rb
openproject-primer_view_components-0.48.1 app/components/primer/open_project/grid_layout.rb
openproject-primer_view_components-0.48.0 app/components/primer/open_project/grid_layout.rb
openproject-primer_view_components-0.47.1 app/components/primer/open_project/grid_layout.rb
openproject-primer_view_components-0.47.0 app/components/primer/open_project/grid_layout.rb
openproject-primer_view_components-0.46.1 app/components/primer/open_project/grid_layout.rb
openproject-primer_view_components-0.46.0 app/components/primer/open_project/grid_layout.rb
openproject-primer_view_components-0.45.0 app/components/primer/open_project/grid_layout.rb
openproject-primer_view_components-0.44.3 app/components/primer/open_project/grid_layout.rb
openproject-primer_view_components-0.44.2 app/components/primer/open_project/grid_layout.rb
openproject-primer_view_components-0.44.1 app/components/primer/open_project/grid_layout.rb