Sha256: eb637db62399a272c17571aa1141cfc430928fd34f7db3d236ef5833269a6173

Contents?: true

Size: 1.27 KB

Versions: 92

Compression:

Stored size: 1.27 KB

Contents

# frozen_string_literal: true

module Playbook
  module PbUser
    class User
      include Playbook::Props

      partial "pb_user/user"

      prop :align, type: Playbook::Props::Enum,
                   values: %w[left center right],
                   default: "left"
      prop :avatar, type: Playbook::Props::Boolean,
                    default: false
      prop :avatar_url
      prop :name
      prop :orientation, type: Playbook::Props::Enum,
                         values: %w[vertical horizontal],
                         default: "horizontal"
      prop :size, type: Playbook::Props::Enum,
                  values: %w[lg md sm],
                  default: "sm"
      prop :title
      prop :dark, type: Playbook::Props::Boolean,
                          default: false
      prop :territory

      def classname
        generate_classname("pb_user_kit", align, orientation, size, dark_class)
      end

      def avatar_size
        case size
        when "lg"
          "xl"
        when "md"
          "md"
        else
          "sm"
        end
      end

      def dark_class
        dark ? "dark" : nil
      end

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

      def details
        [territory, title].reject(&:blank?).join(" • ")
      end
    end
  end
end

Version data entries

92 entries across 92 versions & 1 rubygems

Version Path
playbook_ui-5.2.0.pre.alpha11 app/pb_kits/playbook/pb_user/user.rb
playbook_ui-5.5.1.pre.alpha4 app/pb_kits/playbook/pb_user/user.rb
playbook_ui-5.5.1.pre.alpha3 app/pb_kits/playbook/pb_user/user.rb
playbook_ui-5.5.1.pre.alpha2 app/pb_kits/playbook/pb_user/user.rb
playbook_ui-5.5.1.pre.alpha1 app/pb_kits/playbook/pb_user/user.rb
playbook_ui-5.2.0.pre.alpha10 app/pb_kits/playbook/pb_user/user.rb
playbook_ui-5.5.1 app/pb_kits/playbook/pb_user/user.rb
playbook_ui-5.5.0 app/pb_kits/playbook/pb_user/user.rb
playbook_ui-5.5.0.pre.alpha1 app/pb_kits/playbook/pb_user/user.rb
playbook_ui-5.2.0.pre.alpha9 app/pb_kits/playbook/pb_user/user.rb
playbook_ui-5.2.0.pre.alpha8 app/pb_kits/playbook/pb_user/user.rb
playbook_ui-5.2.0.pre.alpha7 app/pb_kits/playbook/pb_user/user.rb
playbook_ui-5.3.0.pre.alpha1 app/pb_kits/playbook/pb_user/user.rb
playbook_ui-5.4.0 app/pb_kits/playbook/pb_user/user.rb
playbook_ui-5.2.0.pre.alpha6 app/pb_kits/playbook/pb_user/user.rb
playbook_ui-5.2.0.pre.alpha5 app/pb_kits/playbook/pb_user/user.rb
playbook_ui-5.3.0 app/pb_kits/playbook/pb_user/user.rb
playbook_ui-5.2.0.pre.alpha4 app/pb_kits/playbook/pb_user/user.rb
playbook_ui-5.2.0.pre.alpha3 app/pb_kits/playbook/pb_user/user.rb
playbook_ui-5.2.0.pre.alpha2 app/pb_kits/playbook/pb_user/user.rb