Class: Primer::BorderBoxComponent

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

Overview

BorderBox is a Box component with a border.

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 ViewHelper

#primer

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:

Header, body, rows, and footer

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

Parameters:

  • system_arguments (Hash)

    <%= link_to_system_arguments_docs %>



82
83
84
85
86
# File 'app/components/primer/border_box_component.rb', line 82

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



92
93
94
# File 'app/components/primer/border_box_component.rb', line 92

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

Instance Method Details

#render?Boolean

Returns:

  • (Boolean)


88
89
90
# File 'app/components/primer/border_box_component.rb', line 88

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