media assets: add options to download or reverse search the image.

This commit is contained in:
evazion
2022-11-29 14:14:52 -06:00
parent ba8ff9e0a0
commit 695568e08b
6 changed files with 71 additions and 11 deletions

View File

@@ -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