media assets: add options to download or reverse search the image.
This commit is contained in:
@@ -1,15 +1,20 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# A component that shows a "..." button that when clicked displays a popup menu.
|
||||
class PopupMenuComponent < ApplicationComponent
|
||||
include ViewComponent::SlotableV2
|
||||
|
||||
attr_reader :classes
|
||||
attr_reader :hide_on_click, :classes
|
||||
|
||||
renders_one :button
|
||||
renders_many :items
|
||||
renders_many :items, ->(hide_on_click: nil, &block) do
|
||||
tag.li(block.call, "data-hide-on-click": hide_on_click)
|
||||
end
|
||||
|
||||
# @param hide_on_click [Boolean] If true, then automatically hide the menu when anything inside the menu is clicked.
|
||||
# @param classes [String] A list of CSS classes for the root element.
|
||||
def initialize(classes: nil)
|
||||
def initialize(hide_on_click: true, classes: nil)
|
||||
@hide_on_click = hide_on_click
|
||||
@classes = classes
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user