Add dropdown components, menus for RS auth items

This commit is contained in:
Râu Cao
2023-11-18 17:13:55 +01:00
parent 27bb7d1bfe
commit 721dccb499
8 changed files with 80 additions and 11 deletions
+18
View File
@@ -0,0 +1,18 @@
# frozen_string_literal: true
class DropdownLinkComponent < ViewComponent::Base
def initialize(href:, separator: false, add_class: nil)
@href = href
@class = class_str(separator, add_class)
end
private
def class_str(separator, add_class)
str = "no-underline block px-4 py-2 text-sm text-gray-900 bg-white
hover:bg-gray-100 focus:bg-gray-100 whitespace-no-wrap"
str = "#{str} border-t" if separator
str = "#{str} #{add_class}" if add_class
str
end
end