class ViewComponent::Storybook::Controls::SimpleControlConfig
A simple Control Config maps to one Storybook
Control It has a value and pulls its value from params by key
Attributes
default_value[R]
Public Class Methods
new(default_value, param: nil, name: nil)
click to toggle source
Calls superclass method
ViewComponent::Storybook::Controls::ControlConfig::new
# File lib/view_component/storybook/controls/simple_control_config.rb, line 12 def initialize(default_value, param: nil, name: nil) super(param: param, name: name) @default_value = default_value end
Public Instance Methods
to_csf_params()
click to toggle source
# File lib/view_component/storybook/controls/simple_control_config.rb, line 17 def to_csf_params validate! { args: { param => csf_value }, argTypes: { param => { control: csf_control_params, name: name } } } end
value_from_params(params)
click to toggle source
# File lib/view_component/storybook/controls/simple_control_config.rb, line 25 def value_from_params(params) params.key?(param) ? params[param] : default_value end
Private Instance Methods
csf_control_params()
click to toggle source
# File lib/view_component/storybook/controls/simple_control_config.rb, line 42 def csf_control_params { type: type } end
csf_value()
click to toggle source
# File lib/view_component/storybook/controls/simple_control_config.rb, line 38 def csf_value default_value end
type()
click to toggle source
provide extension points for subclasses to vary the value
# File lib/view_component/storybook/controls/simple_control_config.rb, line 32 def type # :nocov: raise NotImplementedError # :nocov: end