app/components/coco/base/icon/icon.rb in coveragebook_components-0.8.0 vs app/components/coco/base/icon/icon.rb in coveragebook_components-0.8.1

- old
+ new

@@ -2,10 +2,16 @@ class Icon < Coco::Component include Concerns::AcceptsOptions ICON_CACHE = {} + ALIASES = { + edit: "pen-line", + "edit-3": "pen-line", + grid: "grid-3x3" + }.freeze + InvalidIconError = Class.new(StandardError) accepts_option :size, from: %i[xs sm md lg xl xxl full] accepts_option :spin, from: [true, false] accepts_option :style, from: [:line, :fill, :custom] @@ -20,10 +26,10 @@ def initialize(name: nil, **kwargs) @icon_name = name&.to_s&.tr("_", "-") end def name - @icon_name + ALIASES.fetch(@icon_name.to_sym, @icon_name) if @icon_name end def svg content || icon_data[:svg] end