style: correct coding style with rubocop linter

This commit is contained in:
kbe
2025-09-05 12:02:44 +02:00
parent 46c8faf10c
commit 15e3c7dff5
40 changed files with 121 additions and 1663 deletions

View File

@@ -1,28 +1,28 @@
module LucideHelper
# Create a Lucide icon element
#
#
# @param name [String] The name of the Lucide icon
# @param options [Hash] Additional options
# @option options [String] :class Additional CSS classes
# @option options [String] :size Size class (e.g., 'w-4 h-4', 'w-6 h-6')
# @option options [Hash] :data Additional data attributes
#
#
# @return [String] HTML string for the icon
#
# Usage:
# lucide_icon('user')
# lucide_icon('user')
# lucide_icon('check-circle', class: 'text-green-500', size: 'w-5 h-5')
# lucide_icon('menu', data: { action: 'click->header#toggleMenu' })
def lucide_icon(name, options = {})
css_classes = ["lucide-icon"]
css_classes = [ "lucide-icon" ]
css_classes << options[:size] if options[:size]
css_classes << options[:class] if options[:class]
data_attributes = { lucide: name }
data_attributes.merge!(options[:data]) if options[:data]
content_tag :i, "",
class: css_classes.join(" "),
content_tag :i, "",
class: css_classes.join(" "),
data: data_attributes,
**options.except(:class, :size, :data)
end
@@ -35,23 +35,23 @@ module LucideHelper
# @option options [String] :class Additional CSS classes for button
# @option options [String] :icon_class Additional CSS classes for icon
# @option options [String] :icon_size Size class for icon
#
#
# Usage:
# lucide_button('plus', text: 'Add Item', class: 'btn btn-primary')
# lucide_button('trash-2', class: 'btn-danger', data: { confirm: 'Are you sure?' })
def lucide_button(name, options = {})
text = options.delete(:text)
icon_class = options.delete(:icon_class)
icon_size = options.delete(:icon_size) || 'w-4 h-4'
icon_size = options.delete(:icon_size) || "w-4 h-4"
icon = lucide_icon(name, class: icon_class, size: icon_size)
content = if text.present?
safe_join([icon, " ", text])
else
safe_join([ icon, " ", text ])
else
icon
end
end
content_tag :button, content, options
end
@@ -60,23 +60,23 @@ module LucideHelper
# @param name [String] The name of the Lucide icon
# @param url [String] The URL for the link
# @param options [Hash] Link options
#
#
# Usage:
# lucide_link('edit', edit_user_path(user), text: 'Edit')
# lucide_link('external-link', 'https://example.com', text: 'Visit', target: '_blank')
def lucide_link(name, url, options = {})
text = options.delete(:text)
icon_class = options.delete(:icon_class)
icon_size = options.delete(:icon_size) || 'w-4 h-4'
icon_size = options.delete(:icon_size) || "w-4 h-4"
icon = lucide_icon(name, class: icon_class, size: icon_size)
content = if text.present?
safe_join([icon, " ", text])
else
safe_join([ icon, " ", text ])
else
icon
end
end
link_to content, url, options
end
end
end