mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-25 20:46:48 +00:00
27 lines
407 B
Ruby
27 lines
407 B
Ruby
# frozen_string_literal: true
|
|
|
|
class HelpModalComponent < ViewComponent::Base
|
|
def initialize(id:, close_button: true)
|
|
@id = id
|
|
@close_button = close_button
|
|
end
|
|
|
|
private
|
|
|
|
def close_button_class
|
|
if namespace == "admin"
|
|
"red"
|
|
else
|
|
"primary"
|
|
end
|
|
end
|
|
|
|
def close_button?
|
|
!!@close_button
|
|
end
|
|
|
|
def namespace
|
|
helpers.controller_path.split("/").first
|
|
end
|
|
end
|