Class: Keystone::Ui::PageHeaderComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Keystone::Ui::PageHeaderComponent
- Defined in:
- app/components/keystone/ui/page_header_component.rb
Constant Summary collapse
- WRAPPER_CLASSES =
"hidden sm:block mb-6 sm:flex sm:items-center sm:justify-between"- TITLE_CLASSES =
"text-2xl font-bold text-gray-900 dark:text-white"- SUBTITLE_CLASSES =
"mt-1 text-sm text-gray-500 dark:text-gray-400"- ACTIONS_CLASSES =
"page-header-actions hidden sm:block mt-4 sm:mt-0 sm:ml-4 flex-shrink-0"
Instance Attribute Summary collapse
-
#action_label ⇒ Object
readonly
Returns the value of attribute action_label.
-
#action_url ⇒ Object
readonly
Returns the value of attribute action_url.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #action(&block) ⇒ Object
- #action? ⇒ Boolean
- #before_render ⇒ Object
-
#initialize(title:, subtitle: nil, action_url: nil, action_label: "Add new") ⇒ PageHeaderComponent
constructor
A new instance of PageHeaderComponent.
- #subtitle? ⇒ Boolean
- #subtitle_text ⇒ Object
Constructor Details
#initialize(title:, subtitle: nil, action_url: nil, action_label: "Add new") ⇒ PageHeaderComponent
Returns a new instance of PageHeaderComponent.
13 14 15 16 17 18 19 |
# File 'app/components/keystone/ui/page_header_component.rb', line 13 def initialize(title:, subtitle: nil, action_url: nil, action_label: "Add new") @title = title @subtitle = subtitle @action_url = action_url @action_label = action_label @action_block = nil end |
Instance Attribute Details
#action_label ⇒ Object (readonly)
Returns the value of attribute action_label.
11 12 13 |
# File 'app/components/keystone/ui/page_header_component.rb', line 11 def action_label @action_label end |
#action_url ⇒ Object (readonly)
Returns the value of attribute action_url.
11 12 13 |
# File 'app/components/keystone/ui/page_header_component.rb', line 11 def action_url @action_url end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
11 12 13 |
# File 'app/components/keystone/ui/page_header_component.rb', line 11 def title @title end |
Instance Method Details
#action(&block) ⇒ Object
25 26 27 |
# File 'app/components/keystone/ui/page_header_component.rb', line 25 def action(&block) @action_block = block end |
#action? ⇒ Boolean
29 30 31 |
# File 'app/components/keystone/ui/page_header_component.rb', line 29 def action? !!@action_block end |
#before_render ⇒ Object
21 22 23 |
# File 'app/components/keystone/ui/page_header_component.rb', line 21 def before_render content end |
#subtitle? ⇒ Boolean
33 34 35 |
# File 'app/components/keystone/ui/page_header_component.rb', line 33 def subtitle? !@subtitle.nil? end |
#subtitle_text ⇒ Object
37 38 39 |
# File 'app/components/keystone/ui/page_header_component.rb', line 37 def subtitle_text @subtitle end |