Sha256: dcf6543716c57420f261a3acffba747fc654dbe9b04fec3703860078d9c598b0

Contents?: true

Size: 843 Bytes

Versions: 2

Compression:

Stored size: 843 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 :value, type: Playbook::Props::Percentage

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

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
playbook_ui-2.9.8 app/pb_kits/playbook/pb_stat_change/stat_change.rb
playbook_ui-2.9.7 app/pb_kits/playbook/pb_stat_change/stat_change.rb