Sha256: ff8ea5f30ed1cbbe5c098ef639d83d4dfd52191696b203d3f73ace97ec5af189

Contents?: true

Size: 759 Bytes

Versions: 200

Compression:

Stored size: 759 Bytes

Contents

# frozen_string_literal: true

module Playbook
  module PbTitleCount
    class TitleCount
      include Playbook::Props

      partial "pb_title_count/title_count"

      prop :align, type: Playbook::Props::Enum,
                   values: %w[left center right],
                   default: "left"
      prop :size, type: Playbook::Props::Enum,
                  values: %w[lg sm],
                  default: "sm"
      prop :title
      prop :count, type: Playbook::Props::Numeric

      def classname
        generate_classname("pb_title_count_kit", align, size)
      end

      def title_size
        size == "lg" ? 3 : 4
      end

      def format_count
        count.to_s.gsub(/(\d)(?=\d{3}+(?:\.|$))(\d{3}\..*)?/, '\1,\2')
      end
    end
  end
end

Version data entries

200 entries across 200 versions & 1 rubygems

Version Path
playbook_ui-5.3.0 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-5.2.0.pre.alpha4 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-5.2.0.pre.alpha3 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-5.2.0.pre.alpha2 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-5.2.0 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-5.1.0 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-5.0.3 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-5.0.2 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-5.0.1.pre.beta app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-5.1.0.pre.alpha4 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-5.1.0.pre.alpha2 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-5.1.0.pre.alpha1 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-5.0.1 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-5.0.1.pre.alpha1 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-4.18.1.pre.alpha1 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-4.18.1 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-4.18.0 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-4.17.0 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-4.17.0.pre.alpha1 app/pb_kits/playbook/pb_title_count/title_count.rb
playbook_ui-4.16.0 app/pb_kits/playbook/pb_title_count/title_count.rb