Sha256: 75b6e4ac4b91b5f67b5f624fb7a017242141a55dd2f94fa55e460a645a366fac

Contents?: true

Size: 1.58 KB

Versions: 32

Compression:

Stored size: 1.58 KB

Contents

# frozen_string_literal: true

module Primer
  module OpenProject
    # Add a general description of component here
    # Add additional usage considerations or best practices that may aid the user to use the component correctly.
    # @accessibility Add any accessibility considerations
    class SidePanel < Primer::Component
      status :open_project

      # @param grid_row_arguments [Hash] Arguments to pass to +Primer::OpenProject::BorderGrid::Cell+ %>
      # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
      # A side panel consists of one or multiple sections
      renders_many :sections, lambda { |component = nil, grid_row_arguments: {}, **system_arguments, &block|
        if component.nil?
          @border_grid.with_row(**grid_row_arguments) do
            render(Primer::OpenProject::SidePanel::Section.new(**system_arguments)) do |section|
              evaluate_block(section, &block)
            end
          end
        elsif component.render?
          @border_grid.with_row(**grid_row_arguments) do
            render(component)
          end
        end
      }

      # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
      def initialize(**system_arguments)
        @system_arguments = system_arguments
        @system_arguments[:classes] = class_names(
          "SidePanel",
          @system_arguments[:classes]
        )

        @border_grid = Primer::OpenProject::BorderGrid.new(**@system_arguments)
      end

      def render?
        sections.present?
      end

      def before_render
        content
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

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