Class: CounterComponentPreview
- Inherits:
-
ViewComponent::Preview
- Object
- ViewComponent::Preview
- CounterComponentPreview
- Defined in:
- lib/generators/frozen/templates/ui/demo_component_tests/counter_component_preview.rb
Initial Values collapse
I18n collapse
- #english ⇒ Object
-
#german ⇒ Object
Caution — Getting too sophisticated within a preview isn’t supported: - [github.com/lookbook-hq/lookbook/issues/793](https://github.com/lookbook-hq/lookbook/issues/793).
Instance Method Summary collapse
-
#custom(initial_value: 0) ⇒ Object
A counter with custom initial value — You probably don’t want to use this component for real, because it doesn’t persist the counter value anywhere.
- #negative_one ⇒ Object
Instance Method Details
#custom(initial_value: 0) ⇒ Object
A counter with custom initial value
You probably don’t want to use this component for real, because it doesn’t persist the counter value anywhere.
9 10 11 |
# File 'lib/generators/frozen/templates/ui/demo_component_tests/counter_component_preview.rb', line 9 def custom(initial_value: 0) render CounterComponent.new(initial_value: initial_value) end |
#english ⇒ Object
35 36 37 38 39 |
# File 'lib/generators/frozen/templates/ui/demo_component_tests/counter_component_preview.rb', line 35 def english I18n.with_locale(:en) do render CounterComponent.new(label: true) end end |
#forty_two ⇒ Object
21 22 23 |
# File 'lib/generators/frozen/templates/ui/demo_component_tests/counter_component_preview.rb', line 21 def forty_two render CounterComponent.new(initial_value: 42) end |
#german ⇒ Object
Caution
Getting too sophisticated within a preview isn’t supported:
47 48 49 50 51 |
# File 'lib/generators/frozen/templates/ui/demo_component_tests/counter_component_preview.rb', line 47 def german I18n.with_locale(:de) do render CounterComponent.new(label: true) end end |
#negative_one ⇒ Object
28 29 30 |
# File 'lib/generators/frozen/templates/ui/demo_component_tests/counter_component_preview.rb', line 28 def negative_one render CounterComponent.new(initial_value: -1) end |
#zero ⇒ Object
16 17 18 |
# File 'lib/generators/frozen/templates/ui/demo_component_tests/counter_component_preview.rb', line 16 def zero render CounterComponent.new end |