Class: Pulse::BorderBox
- Inherits:
-
Component
- Object
- Component
- Pulse::BorderBox
- Defined in:
- app/components/pulse/border_box.rb,
app/components/pulse/border_box/header.rb
Overview
BorderBox is a Box component with a border.
Defined Under Namespace
Classes: Header
Constant Summary collapse
- DEFAULT_PADDING =
:default- PADDING_MAPPINGS =
{ DEFAULT_PADDING => '', :condensed => 'Box--condensed', :spacious => 'Box--spacious' }.freeze
- PADDING_SUGGESTION =
"Perhaps you could consider using :padding options " \ "of #{PADDING_MAPPINGS.keys.to_sentence}?".freeze
- DEFAULT_ROW_SCHEME =
:default- ROW_SCHEME_MAPPINGS =
{ DEFAULT_ROW_SCHEME => '', :neutral => 'Box-row--gray', :info => 'Box-row--blue', :warning => 'Box-row--yellow' }.freeze
Instance Method Summary collapse
-
#initialize(padding: DEFAULT_PADDING, **system_arguments) ⇒ BorderBox
constructor
A new instance of BorderBox.
- #render? ⇒ Boolean
Constructor Details
#initialize(padding: DEFAULT_PADDING, **system_arguments) ⇒ BorderBox
Returns a new instance of BorderBox.
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'app/components/pulse/border_box.rb', line 88 def initialize(padding: DEFAULT_PADDING, **system_arguments) @system_arguments = deny_tag_argument(**system_arguments) @system_arguments[:tag] = :div @system_arguments[:classes] = class_names( 'pulse-bg-white pulse-border pulse-border-gray-300 pulse-border-solid', 'pulse-border-[1px] pulse-rounded-md', PADDING_MAPPINGS[fetch_or_fallback(PADDING_MAPPINGS.keys, padding, DEFAULT_PADDING)], system_arguments[:classes] ) @system_arguments[:system_arguments_denylist] = { [:p, :pt, :pb, :pr, :pl] => PADDING_SUGGESTION } @list_arguments = { tag: :ul, class: class_names # 'pulse-divide-y pulse-divide-gray-300', # 'pulse-border-b pulse-border-gray-300 pulse-border-solid' } end |
Instance Method Details
#render? ⇒ Boolean
110 111 112 |
# File 'app/components/pulse/border_box.rb', line 110 def render? rows.any? || header.present? || body.present? || .present? end |