Class: SdrViewComponents::Elements::ProgressBarComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- SdrViewComponents::Elements::ProgressBarComponent
- Defined in:
- app/components/sdr_view_components/elements/progress_bar_component.rb
Overview
Wait for it.
Instance Attribute Summary collapse
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#percent ⇒ Object
readonly
Returns the value of attribute percent.
Instance Method Summary collapse
- #bar_classes ⇒ Object
- #bar_style ⇒ Object
- #classes ⇒ Object
-
#initialize(label:, percent: 0, variant: nil, classes: [], striped: true, **options) ⇒ ProgressBarComponent
constructor
rubocop:disable Metrics/ParameterLists.
Methods inherited from BaseComponent
#args_for, #merge_actions, #merge_classes
Constructor Details
#initialize(label:, percent: 0, variant: nil, classes: [], striped: true, **options) ⇒ ProgressBarComponent
rubocop:disable Metrics/ParameterLists
7 8 9 10 11 12 13 14 15 |
# File 'app/components/sdr_view_components/elements/progress_bar_component.rb', line 7 def initialize(label:, percent: 0, variant: nil, classes: [], striped: true, **) # rubocop:disable Metrics/ParameterLists @label = label @percent = percent @variant = variant @classes = classes @striped = striped @options = super() end |
Instance Attribute Details
#label ⇒ Object (readonly)
Returns the value of attribute label.
17 18 19 |
# File 'app/components/sdr_view_components/elements/progress_bar_component.rb', line 17 def label @label end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
17 18 19 |
# File 'app/components/sdr_view_components/elements/progress_bar_component.rb', line 17 def @options end |
#percent ⇒ Object (readonly)
Returns the value of attribute percent.
17 18 19 |
# File 'app/components/sdr_view_components/elements/progress_bar_component.rb', line 17 def percent @percent end |
Instance Method Details
#bar_classes ⇒ Object
19 20 21 |
# File 'app/components/sdr_view_components/elements/progress_bar_component.rb', line 19 def merge_classes('progress-bar', variant_class, @striped ? 'progress-bar-striped' : nil) end |
#bar_style ⇒ Object
23 24 25 |
# File 'app/components/sdr_view_components/elements/progress_bar_component.rb', line 23 def "width: #{percent}%;" end |
#classes ⇒ Object
27 28 29 |
# File 'app/components/sdr_view_components/elements/progress_bar_component.rb', line 27 def classes merge_classes('progress', @classes) end |