Sha256: 8eeb077f8d88beaa110b5cf69f1a3cbf3e8530cc677fcc1e0d458d81996e30d0

Contents?: true

Size: 959 Bytes

Versions: 13

Compression:

Stored size: 959 Bytes

Contents

# frozen_string_literal: true

module Playbook
  module PbStatChange
    class StatChange
      include Playbook::Props

      partial "pb_stat_change/stat_change"

      prop :change, type: Playbook::Props::Enum,
                    values: %w[neutral increase decrease],
                    default: "neutral"
      prop :icon, type: Playbook::Props::String
      prop :value, type: Playbook::Props::Numeric

      def status
        case change
        when "increase"
          "positive"
        when "decrease"
          "negative"
        else
          "neutral"
        end
      end

      def returned_icon
        if icon
          icon
        else
          case change
          when "increase"
            "arrow-up"
          when "decrease"
            "arrow-down"
          else
            false
          end
        end
      end

      def classname
        generate_classname("pb_stat_change_kit", status)
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
playbook_ui-7.14.0.pre.alpha1 app/pb_kits/playbook/pb_stat_change/stat_change.rb
playbook_ui-7.16.0 app/pb_kits/playbook/pb_stat_change/stat_change.rb
playbook_ui-7.15.1 app/pb_kits/playbook/pb_stat_change/stat_change.rb
playbook_ui-7.15.0 app/pb_kits/playbook/pb_stat_change/stat_change.rb
playbook_ui-7.14.0 app/pb_kits/playbook/pb_stat_change/stat_change.rb
playbook_ui-7.13.0.pre.alpha1 app/pb_kits/playbook/pb_stat_change/stat_change.rb
playbook_ui-7.13.0 app/pb_kits/playbook/pb_stat_change/stat_change.rb
playbook_ui-7.12.1 app/pb_kits/playbook/pb_stat_change/stat_change.rb
playbook_ui-7.12.0 app/pb_kits/playbook/pb_stat_change/stat_change.rb
playbook_ui-7.11.1 app/pb_kits/playbook/pb_stat_change/stat_change.rb
playbook_ui-7.11.0 app/pb_kits/playbook/pb_stat_change/stat_change.rb
playbook_ui-7.11.0.pre.alpha1 app/pb_kits/playbook/pb_stat_change/stat_change.rb
playbook_ui-7.10.0 app/pb_kits/playbook/pb_stat_change/stat_change.rb