Class: Primer::BorderBoxComponent

Inherits:
Component
  • Object
show all
Includes:
ViewComponent::Slotable
Defined in:
app/components/primer/border_box_component.rb

Overview

BorderBox is a Box component with a border.

Defined Under Namespace

Classes: Body, Footer, Header, Row

Constant Summary

Constants inherited from Component

Component::STATUSES

Constants included from FetchOrFallbackHelper

FetchOrFallbackHelper::InvalidValueError

Class Method Summary collapse

Instance Method Summary collapse

Methods included from JoinStyleArgumentsHelper

#join_style_arguments

Methods included from FetchOrFallbackHelper

#fetch_or_fallback, #fetch_or_fallback_boolean

Methods included from ClassNameHelper

#class_names

Constructor Details

#initialize(**system_arguments) ⇒ BorderBoxComponent

Returns a new instance of BorderBoxComponent.

Examples:

auto|Header, body, rows, and footer

<%= render(Primer::BorderBoxComponent.new) do |component| %>
  <% component.slot(:header) do %>
    Header
  <% end %>
  <% component.slot(:body) do %>
    Body
  <% end %>
  <% component.slot(:row) do %>
    <% if true %>
      Row one
    <% end %>
  <% end %>
  <% component.slot(:row) do %>
    Row two
  <% end %>
  <% component.slot(:footer) do %>
    Footer
  <% end %>
<% end %>

Parameters:

  • system_arguments (Hash)

    <%= link_to_system_arguments_docs %>



35
36
37
38
39
# File 'app/components/primer/border_box_component.rb', line 35

def initialize(**system_arguments)
  @system_arguments = system_arguments
  @system_arguments[:tag] = :div
  @system_arguments[:classes] = class_names("Box", system_arguments[:classes])
end

Class Method Details

.statusObject



45
46
47
# File 'app/components/primer/border_box_component.rb', line 45

def self.status
  Primer::Component::STATUSES[:beta]
end

Instance Method Details

#render?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'app/components/primer/border_box_component.rb', line 41

def render?
  rows.any? || header.present? || body.present? || footer.present?
end