Sha256: 5814eb6b4a3f3d646392e8012767998284761d1d4c0d210e4a9dffa4c7fb694d

Contents?: true

Size: 1010 Bytes

Versions: 91

Compression:

Stored size: 1010 Bytes

Contents

# frozen_string_literal: true

module Playbook
  module PbMultipleUsersStacked
    class MultipleUsersStacked < Playbook::KitBase
      prop :users, type: Playbook::Props::HashArray, required: true

      prop :variant, type: Playbook::Props::Enum,
                     values: %w[default bubble],
                     default: "default"

      def more_than_two
        users.count > 2
      end

      def only_one
        users.count == 1
      end

      def display_count
        more_than_two ? 1 : users.count
      end

      def bubble
        variant == "bubble"
      end

      def triple_bubble
        bubble && users.count === 3
      end

      def quadruple_bubble
        bubble && users.count > 3
      end

      def classname
        generate_classname("pb_multiple_users_stacked_kit", single_class, bubble_class)
      end

    private

      def single_class
        only_one ? "single" : nil
      end

      def bubble_class
        bubble ? "bubble" : nil
      end
    end
  end
end

Version data entries

91 entries across 91 versions & 1 rubygems

Version Path
playbook_ui-14.6.0.pre.rc.12 app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.rb
playbook_ui-14.6.0.pre.rc.11 app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.rb
playbook_ui-14.6.0.pre.rc.10 app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.rb
playbook_ui-14.6.0.pre.rc.9 app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.rb
playbook_ui-14.6.0.pre.rc.8 app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.rb
playbook_ui-14.6.0.pre.rc.7 app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.rb
playbook_ui-14.6.0.pre.rc.6 app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.rb
playbook_ui-14.6.0.pre.rc.5 app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.rb
playbook_ui-14.5.0.pre.alpha.PLAY1510railsformloading3977 app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.rb
playbook_ui-14.5.0.pre.alpha.PLAY1510railsformloading3976 app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.rb
playbook_ui-14.5.0.pre.alpha.PLAY1510railsformloading3975 app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.rb
playbook_ui-14.6.0.pre.rc.4 app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.rb
playbook_ui-14.6.0.pre.rc.3 app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.rb
playbook_ui-14.6.0.pre.rc.2 app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.rb
playbook_ui-14.5.0.pre.alpha.PLAY1486highchartscssdrivenPOC3954 app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.rb
playbook_ui-14.5.0.pre.alpha.PLAY1486highchartscssdrivenPOC3953 app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.rb
playbook_ui-14.5.0.pre.alpha.PLAY1486highchartscssdrivenPOC3950 app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.rb
playbook_ui-14.5.0.pre.alpha.PBNTR374multilevelselectPOC3946 app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.rb
playbook_ui-14.5.0.pre.alpha.PLAY1486highchartscssdrivenPOC3944 app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.rb
playbook_ui-14.6.0.pre.rc.1 app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.rb