Class: Optics::Sidebar::Component
- Inherits:
-
ApplicationViewComponent
- Object
- ViewComponent::Base
- ApplicationViewComponent
- Optics::Sidebar::Component
- Defined in:
- app/components/optics/sidebar/component.rb
Defined Under Namespace
Classes: Brand, LinksComponent, SidebarContent
Constant Summary collapse
- VARIANTS =
%w[drawer compact rail].freeze
Instance Method Summary collapse
Methods inherited from ApplicationViewComponent
accepts, #class_for, #class_names, #class_names_for, #container_class, #data_for, #data_method, #data_target, #data_values, #identifier, inherited, #initialize, requires
Constructor Details
This class inherits a constructor from Optics::ApplicationViewComponent
Instance Method Details
#call ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/components/optics/sidebar/component.rb', line 14 def call content_tag( :nav, class: classes, **@attributes.except(:class) ) do capture do concat brand .each do |content| concat content end end end end |
#classes ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'app/components/optics/sidebar/component.rb', line 29 def classes class_names( 'sidebar', variant_class, @attributes[:class], 'sidebar--responsive': responsive ).join(' ') end |
#variant_class ⇒ Object
38 39 40 |
# File 'app/components/optics/sidebar/component.rb', line 38 def variant_class "sidebar--#{variant}" end |