summaryrefslogtreecommitdiff
path: root/lib/sidebars/menu_item.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sidebars/menu_item.rb')
-rw-r--r--lib/sidebars/menu_item.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/sidebars/menu_item.rb b/lib/sidebars/menu_item.rb
new file mode 100644
index 00000000000..b0a12e769dc
--- /dev/null
+++ b/lib/sidebars/menu_item.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+module Sidebars
+ class MenuItem
+ attr_reader :title, :link, :active_routes, :item_id, :container_html_options, :sprite_icon, :sprite_icon_html_options, :hint_html_options
+
+ def initialize(title:, link:, active_routes:, item_id: nil, container_html_options: {}, sprite_icon: nil, sprite_icon_html_options: {}, hint_html_options: {})
+ @title = title
+ @link = link
+ @active_routes = active_routes
+ @item_id = item_id
+ @container_html_options = { aria: { label: title } }.merge(container_html_options)
+ @sprite_icon = sprite_icon
+ @sprite_icon_html_options = sprite_icon_html_options
+ @hint_html_options = hint_html_options
+ end
+
+ def show_hint?
+ hint_html_options.present?
+ end
+
+ def render?
+ true
+ end
+ end
+end