Class: Head::Sidebars::Category

Inherits:
ApplicationComponent show all
Defined in:
app/components/head/sidebars/category.rb

Instance Method Summary collapse

Methods inherited from ApplicationComponent

#initialize

Constructor Details

This class inherits a constructor from Head::ApplicationComponent

Instance Method Details

#css_classesObject



24
25
26
# File 'app/components/head/sidebars/category.rb', line 24

def css_classes
  "c-head-sidebar__category #{'js-head-sidebar__category' if submenu?}"
end

#dataObject



32
33
34
35
36
# File 'app/components/head/sidebars/category.rb', line 32

def data
  return unless submenu?

  { identifier: }
end

#icon_classesObject



28
29
30
# File 'app/components/head/sidebars/category.rb', line 28

def icon_classes
  "#{icon_class_prefix}#{icon.to_s.gsub('_', '-')} c-head-sidebar__category-icon"
end

#identifierObject



46
47
48
# File 'app/components/head/sidebars/category.rb', line 46

def identifier
  @identifier ||= SecureRandom.hex
end

Returns:

  • (Boolean)


38
39
40
# File 'app/components/head/sidebars/category.rb', line 38

def submenu?
  url == '#'
end

#with_separatorObject



42
43
44
# File 'app/components/head/sidebars/category.rb', line 42

def with_separator
  with_link(name: nil, icon: nil)
end