Sha256: 3339b3a24162b9030f0772a216dce380202c0689f2ed7f0032206ccb053773e2

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

module Primer
  # :nodoc:
  module Deprecations
    # If there is no alternative to suggest, set the value to nil
    DEPRECATED_COMPONENTS = {
      "Primer::LabelComponent" => "Primer::Beta::Label",
      "Primer::LinkComponent" => "Primer::Beta::Link",
      "Primer::Image" => "Primer::Alpha::Image",
      "Primer::Alpha::AutoComplete" => "Primer::Beta::AutoComplete",
      "Primer::Alpha::AutoComplete::Item" => "Primer::Beta::AutoComplete::Item",
      "Primer::BlankslateComponent" => "Primer::Beta::Blankslate",
      "Primer::BoxComponent" => "Primer::Box",
      "Primer::CounterComponent" => "Primer::Beta::Counter",
      "Primer::DropdownMenuComponent" => nil,
      "Primer::IconButton" => "Primer::Beta::IconButton",
      "Primer::Tooltip" => "Primer::Alpha::Tooltip"
    }.freeze

    def self.deprecated?(name)
      DEPRECATED_COMPONENTS.key?(name)
    end

    def self.suggested_component(name)
      DEPRECATED_COMPONENTS[name]
    end

    def self.correctable?(name)
      !suggested_component(name).nil?
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
primer_view_components-0.0.109 lib/primer/deprecations.rb
primer_view_components-0.0.108 lib/primer/deprecations.rb
primer_view_components-0.0.107 lib/primer/deprecations.rb