Class: Polaris::CardComponent
- Defined in:
- app/components/polaris/card_component.rb
Constant Summary collapse
- FOOTER_ACTION_ALIGNMENT_DEFAULT =
:right- FOOTER_ACTION_ALIGNMENT_MAPPINGS =
{ FOOTER_ACTION_ALIGNMENT_DEFAULT => "", :left => "Polaris-Card__LeftJustified" }
- FOOTER_ACTION_ALIGNMENT_OPTIONS =
FOOTER_ACTION_ALIGNMENT_MAPPINGS.keys
Constants included from ViewHelper
ViewHelper::POLARIS_HELPERS, ViewHelper::POLARIS_TEXT_STYLES
Constants included from FetchOrFallbackHelper
FetchOrFallbackHelper::InvalidValueError
Instance Method Summary collapse
- #footer_classes ⇒ Object
-
#initialize(title: "", actions: [], sectioned: true, subdued: false, footer_action_alignment: FOOTER_ACTION_ALIGNMENT_DEFAULT, **system_arguments) ⇒ CardComponent
constructor
A new instance of CardComponent.
- #render_footer? ⇒ Boolean
Methods included from ViewHelper
#polaris_body_styles, #polaris_icon_source, #polaris_inversed_colors
Methods included from OptionHelper
#append_option, #prepend_option
Methods included from FetchOrFallbackHelper
#fetch_or_fallback, #fetch_or_fallback_boolean
Methods included from ClassNameHelper
Constructor Details
#initialize(title: "", actions: [], sectioned: true, subdued: false, footer_action_alignment: FOOTER_ACTION_ALIGNMENT_DEFAULT, **system_arguments) ⇒ CardComponent
Returns a new instance of CardComponent.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/components/polaris/card_component.rb', line 20 def initialize( title: "", actions: [], sectioned: true, subdued: false, footer_action_alignment: FOOTER_ACTION_ALIGNMENT_DEFAULT, **system_arguments ) @title = title @actions = actions @sectioned = sectioned @footer_action_alignment = @system_arguments = system_arguments @system_arguments[:tag] = :div @system_arguments[:classes] = class_names( @system_arguments[:classes], "Polaris-Card", "Polaris-Card--subdued": subdued ) end |
Instance Method Details
#footer_classes ⇒ Object
46 47 48 49 50 51 |
# File 'app/components/polaris/card_component.rb', line 46 def class_names( "Polaris-Card__Footer", FOOTER_ACTION_ALIGNMENT_MAPPINGS[fetch_or_fallback(FOOTER_ACTION_ALIGNMENT_OPTIONS, @footer_action_alignment, FOOTER_ACTION_ALIGNMENT_DEFAULT)] ) end |
#render_footer? ⇒ Boolean
42 43 44 |
# File 'app/components/polaris/card_component.rb', line 42 def .present? || .any? end |