Class: KozenetUi::BaseComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- KozenetUi::BaseComponent
- Defined in:
- app/components/kozenet_ui/base_component.rb
Overview
Base component that all Kozenet UI components inherit from Provides common functionality for variant handling, class merging, etc.
Direct Known Subclasses
AvatarComponent, BadgeComponent, ButtonComponent, HeaderComponent, HeaderComponent::ActionButtonComponent, HeaderComponent::BrandComponent, HeaderComponent::CtaComponent, HeaderComponent::NavItemComponent, HeaderComponent::SearchComponent, HeaderComponent::UserMenuComponent
Constant Summary collapse
- UNSET =
Object.new.freeze
Instance Attribute Summary collapse
-
#html_options ⇒ Object
readonly
Returns the value of attribute html_options.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#variant ⇒ Object
readonly
Returns the value of attribute variant.
Instance Method Summary collapse
-
#initialize(variant: nil, size: nil, class: nil, **html_options) ⇒ BaseComponent
constructor
A new instance of BaseComponent.
Constructor Details
#initialize(variant: nil, size: nil, class: nil, **html_options) ⇒ BaseComponent
Returns a new instance of BaseComponent.
11 12 13 14 15 16 17 |
# File 'app/components/kozenet_ui/base_component.rb', line 11 def initialize(variant: nil, size: nil, class: nil, **) super() @variant = variant || KozenetUi.configuration.default_variant @size = size || KozenetUi.configuration.default_size @custom_class = binding.local_variable_get(:class) @html_options = end |
Instance Attribute Details
#html_options ⇒ Object (readonly)
Returns the value of attribute html_options.
9 10 11 |
# File 'app/components/kozenet_ui/base_component.rb', line 9 def @html_options end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
9 10 11 |
# File 'app/components/kozenet_ui/base_component.rb', line 9 def size @size end |
#variant ⇒ Object (readonly)
Returns the value of attribute variant.
9 10 11 |
# File 'app/components/kozenet_ui/base_component.rb', line 9 def variant @variant end |