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

Instance Method Summary collapse

Methods inherited from Component

status

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:

350|Header, body, rows, and footer

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

Parameters:

  • system_arguments (Hash)

    <%= link_to_system_arguments_docs %>



24
25
26
27
28
29
30
31
# File 'app/components/primer/border_box_component.rb', line 24

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

Instance Method Details

#render?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'app/components/primer/border_box_component.rb', line 33

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